How to Install MariaDB 10 on CentOS 7

Install MariaDB on CentOS 7

MariaDB is the fork of MySQL and backward compatible replacement for MySQL. In CentOS 7 main repository by default contains repository for MariaDB. Here in this tutorial, we are going to show you how to install MariaDB 10 on CentOS 7.


Before you start installing MariaDB 10.3 on CentOS 7. You must have a non-root user account on your server with sudo privileges.

1. Install MariaDB 10

First create a new file /etc/yum.repos.d/MariaDB.repo to enable MariaDB 10 repository on CentOS using following command:

sudo nano /etc/yum.repos.d/MariaDB.repo

Now paste following code inside above file to get started:

name = MariaDB
baseurl =

Now install MariaDB-server and MariaDB-client packages on CentOS 7 run below command, You may be asked to confirm importing GPG key then enter Y to continue:

sudo yum install MariaDB-server MariaDB-client

To start MariaDB service by using following command:

sudo systemctl start mariadb

To check status and confirm the installation you can type following command:

sudo systemctl status mariadb

The output should be :

● mariadb.service - MariaDB 10.3.8 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
   Active: inactive (dead)
     Docs: man:mysqld(8)

To start MariaDB after boot process type following command in terminal:

sudo systemctl enable mariadb

2. Setting Up MariaDB

After installation, we have to improve MariaDB security by typing following

sudo mysql_secure_installation

NOTE: it is recommended to answer ‘Y’ for all questions asked during secure installation.

You can log in to MariaDB by typing

mysql -u root -p


You have successfully learned how to install MariaDB 10 on CentOS 7. If you have any queries please don’t forget to comment out.