How to install MariaDB on Rocky Linux 9 / CentOS 9 Stream

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Hello, friends. In this post, you will learn how to install MariaDB on Rocky Linux 9 / CentOS 9 Stream.

MariaDB is a relational database manager that is a fork of MySQL but has gone its own personality-based way.

It is well known all over the world, and we could consider it as a solid alternative to MySQL because it incorporates more engines and evolves in the right way.

Let’s go for it.

Install MariaDB on Rocky Linux 9 / CentOS 9 Stream

Fortunately, MariaDB is present in the official Rocky Linux 9 / CentOS 9 repositories. So, it is not complicated to install it.

So, open a terminal or from an SSH connection, update the system.

sudo dnf update

Then, you can install MariaDB with the following command:

sudo dnf install mariadb-server mariadb
Install MariaDB on Rocky Linux 9 / CentOS 9 Stream
Install MariaDB on Rocky Linux 9 / CentOS 9 Stream

Once the installation is finished, check the installed version

mariadb --version

Sample output:

mariadb Ver 15.1 Distrib 10.5.16-MariaDB, for Linux (x86_64) using EditLine wrapper

Now we have to configure it.

Configuring MariaDB on Rocky Linux 9 / CentOS 9

Before using it, we have to make sure it is running. To do this,

sudo systemctl start mariadb

Then, check the status of the service

sudo systemctl status mariadb

If you get an output screen like this, then all is well.

MariaDB status
MariaDB status

Another thing to keep in mind is that sometimes you will have to restart MariaDB to apply configurations.

sudo systemctl restart mariadb

Or stop it:

sudo systemctl stop mariadb

And the most recommended is to start it with the system:

sudo systemctl enable mariadb

That way, you can manage the service on the system.

Now, you have to configure it. To achieve this, run this command.

sudo mysql_secure_installation

And you will see a series of questions. The first one asks you to enter the root password.

Enter current password for root (enter for none):

As there is none defined, you can press ENTER.

When you do so, you will be asked if you want to switch to the unix_socket authentication plugin.

Switch to unix_socket authentication [Y/n]

Then, you can change the root password. Since there is none, it is best to define it.

Change the root password [Y/n] 

Define yours, and then you will be asked a configuration question. In my case, it is best to answer Y to all of them.

Remove anonymous users? [Y/n]
Disallow root login remotely [Y/n]
Remove test database and access to it? [Y/n]  
Reload privilege tables now [Y/n] 

Next, you will see this message indicating that MariaDB is ready for battle.

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

This way, you will be able to use it.

Conclusion

In this post, you learned how to install MariaDB on Rocky Linux 9 / CentOS 9 Stream. The process is simple, but still interesting for newbies and more experienced users.

Thanks-

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook