Install MariaDB on CentOS 7 with these Simple Steps

An open-source database management system, MariaDB is commonly installed as part of the popular LEMP (Linux, Nginx, MySQL/MariaDB, PHP/Python/Perl) stack. The data is managed by MariaDB by using a relational database and SQL (Structured Query Language). It acts as a fork of MySQL that is managed by the original MySQL developers. Since it’s designed as a replacement for MySQL, it uses commands that reference mysql and is the default package on CentOS 7.

This tutorial explains the installation of the latest version of MariaDB on a CentOS 7 server.


To work as per this tutorial you will need –

A CentOS 7 with a non-root with sudo privileges.

Step 1 – Installation of MariaDB

In this tutorial yum will be used to install the MariaDB package, pressing y when prompted to confirm that we are ready to proceed.

After the installation is complete, start the daemon with the command as below –

As systemctl doesn’t display the outcome of all service management commands, the following command needs to be used to check whether the previous command was successful –

If the MariaDB was started successfully, the output should contain “Active: active (running)” and the final line needs to look like –

Now, let’s check if MariaDB starts at boot using the systemctl enable command that will create the essential symlinks .

Step 2 – Securing the MariaDB Server

There’s a security script to change some of the less secure default options for things like remote root logins and sample users. Use the command below to run the security script –

You will get detailed information for every step with this script. Firstly, you will be prompted for the root password which hasn’t been set so press ENTER after its recommendation. Next you will be prompted to set that root password which you will need to insert.

Then accept all security suggestions by pressing Y and press ENTER for the remaining prompts that will remove anonymous users, disallow remote root login, remove the test database and reload the privilege tables.

Step 3 – Installation Testing

Installation can be verified and one can get information about it by connecting with the mysqladmin tool, a client that lets you run administrative commands. Use the command below to connect to MariaDB as root (-uroot), prompt for a password (-p) and return the version –

The output will be similar to this –

This proves that installation is successful.

This entry was posted in Web Hosting and tagged , . Bookmark the permalink.