How to Install and Secure MariaDB 10 in CentOS 7

Step 1: Add MariaDB Yum Repository

1. Start by adding the MariaDB YUM repository file MariaDB.repo for RHEL/CentOS and Fedora systems.

# vi /etc/yum.repos.d/MariaDB.repo

Now add the following lines to your respective Linux distribution version as shown.

On CentOS 7

name = MariaDB
baseurl =


name = MariaDB
baseurl =

Add MariaDB Yum Repo

Step 2: Install MariaDB in CentOS 7

2. Once MariaDB repository has been added, you can easily install it with just one single command.

# yum install MariaDB-server MariaDB-client -y

Install MariaDB in CentOS 7

3. As soon as the installation of MariaDB packages completes, start the database server daemon for the time being, and also enable it to start automatically at the next boot like so:

# systemctl start mariadb
# systemctl enable mariadb
# systemctl status mariadb

Start MariaDB Service in CentOS 7

Step 3: Secure MariaDB in CentOS 7

4. Now its time to secure your MariaDB by setting root password, disabling remote root login, removing the test database as well as anonymous users and finally reload privileges as shown in the screen shot below:

# mysql_secure_installation

Secure MySQL in CentOS 7

5. After securing the database server, you may want to check certain MariaDB features such as: installed version, default program argument list, and also login to the MariaDB command shell as follows:

# mysql -V
# mysqld --print-defaults
# mysql -u root -p

Verify MySQL Version

Step 4: Learn MariaDB Administration

หมวดหมู่เนื้อหา Blog: