How to Install MariaDB on CentOS 8

Install MariaDB CentOS 8

MariaDB is an open-source, freely available database management software and used as a replacement for MySQL Oracle DB server. It is a community-driven, multi-user, and multi-threaded database server. MariaDB was developed by the developers of the original Oracle MySQL database server community. You can install the MariaDB server almost on each type of operating system including Linux.

This article will explain 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.


To start the installation, you should make sure that you must log in from your root account or sudo privileges.

Installing MariaDB SQL server on CentOS 8

Access the terminal by clicking on the ‘Activities’ and further click on the ‘Terminal’ icon from the left sidebar which is also shown in the following screenshot:

Follow the following steps to successfully run the MariaDB server on your CentOS 8 system:

Step 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.

Step 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

Step 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

Step 4: Make Installation of MariaDB more Secure

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 the following questions which are mentioned in the below-given screenshot:

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.

Remove 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


Congratulations! MariaDB has been successfully installed on your CentOS 8 system. Now can create new databases and grant privileges to other database users. Today, you have learned about the installation of MariaDB on the CentOS 8 Linux system in this article. Now, in further articles, you will learn how to add users and create new databases for web or desktop applications which will be written in PHP, Python, and more.

Similar Posts