Knowledgebase:
Installing And Configuring MariaDB On CentOS 7
Posted by Daniel Naval, Last modified by Daniel Naval on 11 May 2019 06:23 PM

What is MariaDB?

MariaDB Server is another most popular open source database server in the world which is also made by developers of MySQL.
It is an enhanced replacement for MySQL that is mostly used because it is fast. For more information about MariaDB, you may see this LINK.

You need to be logged in to your CentOS 7 with root privileges (sudo su -) before proceeding with the installation.

Installing MariaDB
We will be using “yum” package manager in installing the MariaDB. To start, you may use the command below:

yum install -y mariadb-server

Once it is installed, you need to start and enable the MariaDB service using the commands below:

systemctl start mariadb
systemctl enable mariadb

When you enable the MariaDB service, it will start the service everytime the server is booted up.

To check if the service is installed and running successfully, you may use this command:
systemctl status mariadb

This will show the screen below:

 

Next, you will need to run the script that will perform the security setup on your MariaDB Server.
This will let you setup root user password, purge anonymous user accounts, restrict root user access to the local machine, and remove the test database. The system will explain all the details when you execute the command below:

mysql_secure_installation

On this part, it is recommended to choose Yes on all the questions.

 

Connecting to MariaDB from CentOS 7 CLI
To login to your MariaDB server via the command line using the root account, just type in:

mysql -u root -p

You will then be prompted to enter the password which you have set previously after you initiated the secure installation. Once logged in, you will see the screen as shown below: