Home MySQL How to Install MariaDB Server in Rocky Linux

How to Install MariaDB Server in Rocky Linux

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.

Prerequisite

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 
Install MariaDB in Rocky Linux
Install MariaDB in Rocky Linux

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
Check MariaDB in Rocky Linux
Check MariaDB in Rocky Linux

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 
Secure MariaDB in Rocky Linux
Secure MariaDB in Rocky Linux

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 linuxshelltips@localhost IDENTIFIED BY "Your_preferred_db_user_password";
MariaDB [(none)]> CREATE DATABASE linuxshelltips_db;
MariaDB [(none)]> GRANT ALL ON linuxshelltips_db.* TO linuxshelltips@localhost; 
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit 
Create MySQL User in Rocky Linux
Create MySQL User in Rocky Linux

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.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.