How to Install MariaDB on CentOS 8

MariaDB is an open-source, community-developed relational database management system. It is forked from MySQL and created and maintained by the developers who created MySQL. MariaDB is intended to be highly compatible with MySQL but new features have been added to MariaDB like new storage engines (Aria, ColumnStore, MyRocks).

In this article, we will take a look at the installation and configuration of MariaDB on CentOS 8 Linux.

Step 1: Enable the MariaDB Repository on CentOS 8

Go to the official MariaDB downloads page and select CentOS as the distribution and CentOS 8 as the version and MariaDB 10.5 (stable version) to get the repository.

Once you select the details, you will get MariaDB YUM repository entires. Copy and paste these entries into a file called /etc/yum.repos.d/MariaDB.repo.

$ sudo vim /etc/yum.repos.d/mariadb.repo
# MariaDB 10.5 CentOS repository list - created 2020-12-15 07:13 UTC
name = MariaDB
baseurl =

Once the repository file in place, you can verify the repository by running the following command.

$ dnf repolist
Check MariaDB Repository
Check MariaDB Repository

Step 2: Installing MariaDB on CentOS 8

Now use the dnf command to install the MariaDB package.

$ sudo dnf install MariaDB-server -y

Next, start the MariaDB service and enable it to autostart during system startup.

$ systemctl start mariadb
$ systemctl enable mariadb

Check the status of the MariaDB service by running the following command.

$ systemctl status mariadb 
Check MariaDB Status
Check MariaDB Status

If you have a firewall enabled, you need to add MariaDB to the firewall rule by running the below command. Once the rule is added, the firewall needs to be reloaded.

$ sudo firewall-cmd --permanent --add-service=mysql
$ sudo firewall-cmd --reload

Step 3: Securing the MariaDB Server on CentOS 8

As the last step, we need to run a secure MariaDB installation script. This script takes care of setting up the root password, reloading privileges, removing test databases, disallowing root login.

$ sudo mysql_secure_installation
Secure MariaDB in CentOS 8
Secure MariaDB in CentOS 8

Now connect to MariaDB as the root user and check the version by running the following commands.

$ mysql -uroot -p
Connect to MariaDB Shell
Connect to MariaDB Shell

That’s it for this article. We have seen how to install and configure MariaDB on CentOS 8 Linux.

Tutorial Feedback...
Was this article helpful? If you don't find this article helpful or found some outdated info, issue or a typo, do post your valuable feedback or suggestions in the comments to help improve this article...

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

2 thoughts on “How to Install MariaDB on CentOS 8”

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.