The name MariaDB needs no introduction as its track record on numerous web-based and desktop-based projects speak for itself. The maturity in MariaDB’s performance delivery also makes it an ideal candidate for data analytics due to its columnar database solution. Therefore, if you are aiming for large-scale real-time analytics, MariaDB has your back.
Rocky Linux being a Red Hat Enterprise downstream as a result of it being Centos’ fork makes it an ideal server environment to run web-based projects that require the reputation of MariaDB database management prowess.
On the Rocky Linux operating system you are using, make sure you have full administrative privileges i.e. be a sudoer/root user on the Rocky Linux system.
Installing MariaDB in Rocky Linux
An updated system is optimized for better performance which also affects the software packages installed on that system.
$ sudo dnf update && sudo dnf upgrade -y
Next, install MariaDB database software on your Rocky Linux system.
$ sudo dnf install mariadb-server -y
The database software installation process should take a minute or two to complete.
Once installed, make sure to start and enable database management software, so that it will keep on running even after a system reboot/shutdown.
$ sudo systemctl start mariadb $ sudo systemctl enable mariadb $ sudo systemctl status mariadb
Securing MariaDB in Rocky Linux
Next, you need to secure the MariaDB installation by setting a strong root database user password, removing anonymous DB users, and disallowing remote login.
$ sudo mysql_secure_installation
You can now try to access the database with the set root user password.
$ mysql -u root -p
Create a database user, database, and assign control over the created database to the user.
MariaDB [(none)]> CREATE USER linuxshellt[email protected] IDENTIFIED BY "Your_preferred_db_user_password"; MariaDB [(none)]> CREATE DATABASE linuxshelltips_db; MariaDB [(none)]> GRANT ALL ON linuxshelltips_db.* TO [email protected]; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> exit
We have successfully installed, configured, and demonstrated the implementation of some SQL commands under MariaDB database management software. Your Rocky Linux system is now ready to embrace database-driven web-based projects.