This tutorial shows you how to install and configure MariaDB 10 and latest version on CentOS 7. As you may probably already know, MariaDB database server is now the default on CentOS. It was MySQL before but because of Oracle (MySQL parent company) GPL licensing issues, the opensource community is gradually moving away from MySQL to MariaDB.

If you don’t know the story, here’s a brief summary. Prior to Oracle owning MySQL, it was based on the GPL (GNU General Public License) which states that you can use the software free of charge, but you cannot modify and sell it unless you release the source code. This means you can use it in your closed-source project as well.

When Oracle changed the licensing agreement from the GPL model, most in the opensource community revolted and some started a group that folk out MySQL and created MariaDB.

So basically, MariaDB database server is the same as MySQL but with a GPL licensing model. If you rip out MySQL and install MariaDB, all the services that depended MySQL will not know the deference.

Now that you know a little more of why and how MariaDB was founded, let’s get going to learn how to install it on CentOS 7.


  • Installing MariaDB on CentOS 7

Now that MariaDB is the default database server for CentOS, all you have to do is run the commands below to install it. The problem is, it downloads and installs an older but stable version of MariaDB.

If you want to install the latest version of MariaDB, you must add its software repository to your machine and install. To do that, run the commands below to create a repository file.

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

Then copy and paste the lines below into the file and save it.

name = MariaDB
baseurl =

Finally, run the commands below to install MariaDB 10 on your machine.

sudo yum install MariaDB-server MariaDB-client

If you run into trouble with errors that MariaDB can’t be installed because of conflict with mariadb-libs-xxxx, run the commands below to remove it then re-run the installation commands above.

sudo yum remove mariadb-libs*

It should also remove the postfix package. Re-run the commands above to install MariaDB.

When the installation completes, run the commands below to start MariaDB server.

sudo /etc/init.d/mysql start

Next, run the commands below to secure your database server.

sudo mysql_secure_installation

Next, choose Yes for the rest of the prompts until you’re done.

  • Enter current password for root (enter for none): press Enter
  • Set root password? Y
    • New password: Type new root password
    • Re-enter new password: Confirm the password
  • Remove anonymous users? Y
  • Disallow root login remotely? Y
  • Remove test database and access to it? Y
  • Reload privilege tables now? Y

The final thing go do is replace the default cnf.ini file in the /etc/ directory with one defined for MariaDB. Go to this location:

cd /usr/share/mysql

And use one of the pre-defined cnf.ini configurations available (Huge, Medium and Small) Memory sizes.

Backup your currnet cnf.ini file.

sudo mv /etc/cnf.ini /etc/cnf.ini.bak

Then copy one of the pre-defined configuration for MariaDB.

sudo cp /usr/share/mysql/my-huge.cnf /etc/cnf.ini

Restart MaraiDB and you’re done.