Install MariaDB on CentOS 8 - Step by step process ?

The MariaDB database is a multi-user, multi-threaded SQL database server that consists of the MariaDB server daemon ( mysqld ) and many client programs and libraries. In Red Hat Enterprise Linux, the mariadb-server package provides MariaDB.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform MariaDB server installation and configuration task.

In this context, we shall look into how to install the latest version of MariaDB SQL Server database on your CentOS 8 system. 

We will also explore how to start MariaDB services on CentOS 8.

How to install MariaDB SQL server on CentOS 8 ?

To begin, ensure that you have root access to the server with sudo privileges.

Then, Access the terminal by clicking on the ‘Activities’ and further click on the 'Terminal' icon from the left sidebar.

Now, you can follow the steps given below to install MariaDB server on your CentOS 8 system.

1. Install MariaDB

Now, type the following command to install the MariaDB server version 10.3.17:

$ sudo yum install mariadb-server

During the installation, it will prompt you that either you want to continue the installation further or not. Press 'y' to complete the installation of MariaDB.

2. Enable MariaDB Services

Once the installation of the MariaDB server is completed, you will enable its services by running the below-given command:

$ sudo systemctl enable mariadb.service

3. Start MariaDB services

Start the services by using the following command:

$ sudo systemctl start mariadb.service


$ sudo systemctl restart mariadb.service

Now, check the running status of MariaDB services by using the following command:

$ sudo systemctl status mariadb.service

4. Secure MariaDB Installation

To make the installation of the MariaDB server more secure, run the below mentioned command on the terminal:

$ sudo mysql_secure_installation

Set the root password during the installation and you need to press 'y' to confirm all the necessary questions.

Now, you will log in to the MariaDB server as the root user. 

Type the following command to login into the MariaDB server as the root user:

$ mysql -u root –p

Using the following command, you can also view the list of all databases:

> show databases

To exit from the MariaDB server environment type the following command:

> quit

After executing the above command, you will notice that the current MariaDB environment is closed now.

How to uninstall Mariadb from CentOS 8 ?

To remove mariadb from your CentOS system, use the following command:

$ sudo yum remove mariadb-server mariadb-client

This will not remove the mariadb directories from your system. 

Therefore, to remove all directories run the below mentioned command:

$ sudo rm –r /var/lib/mysql

[Need urgent assistance to install Missing packages on CentOS Linux System ? We are available to help you. ]


This article will guide you on how to install MariaDB on your CentOS 8 system. Now you can create new databases and grant privileges to other database users. Also, you can add users and create new databases for web or desktop applications which will be written in PHP, Python, and so on.

In MariaDB replication is faster whereas in MySQL replication is slower. 

MariaDB is Open Source whereas MySQL uses some proprietary code in its Enterprise Edition. 

MariaDB doesn't support Data Masking and Dynamic column while MySQL supports it. Comparatively MariaDB is faster than MySQL.

To uninstall MariaDB and install mysql:

1. Purge mariadb sudo apt purge mariadb-* Remove all databases ('Yes' answer)

2. Purge mysql sudo apt purge mysql-*

3. Remove folders: sudo rm -r /usr/share/mysql/ sudo rm -r /etc/mysql/ sudo rm -r /lib/systemd/system/mysql.service.

4. Now you can try to install oracle mysql: sudo apt install mysql-server.