How to install MariaDB on Linux server - a guide

+1 vote

Good day to you!

I’m going to change MySQL for MariaDB, but cannot install it. I write yum install maria-db, but yum fails to find anything like this.

Please, post a detailed instruction on how to install and set up MariaDB on the CentOS server.

Thank you!

asked Jul 28, 2016 in System administration by Travis O

1 Answer

0 votes

I completely uphold your decision! I have switched my servers over to MariaDB from MySQL 3 years ago and this was a coerced choice. After being bought by Oracle, MySQL versions were getting worse and worse. Ongoing fails and chart errors produced a negative influence on sites availability, and that was the time, when the decision to switch over to MariaDB was taken.
The result has met our expectations completely, MariaDB is highly stable and well optimized. A three-year long uptime without fails on several servers – is a sufficient proof.

Choosing MariaDB version

MariaDB versions review

There are 2 series of MariaDB - 5.x and 10.x. 
5.x – the versions that are maximum close to MySQL of the latest versions, they are fully compatible with MySQL. If you are just switching to MariaDB from MySQL – this version line is for you.
10.x – is a new version line, which was started after 5.5 version. These versions don’t duplicate all the new functions of the latest MySQL versions, but contain their own useful functions. They are still compatible with MySQL, but if you are just starting using MariaDB – it’s better to use 5.5 first.

Installing MariaDB on Linux server

MariaDB distros are not usually included into repositories of the basic Linux distros (for example, in CentOS 6 and CentOS 7). However, even if they were there, it’s advisable to install the native-mode repository MariaDB into the system, in order to have up-to-date versions available all the time. To install yum repository, follow the instruction:

1. Create a new repository file, using the command:

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

Press i button to switch to the edit mode of vi editing program.

2. Get a file text for your version of Linux distro via this link. You will need to choose the distro name, its version and release:

Setting up MariaDB repositories


Copy the text for the repository file, insert it into your file and press ":wq" to save and exit vi editing program.
Now, you can install MariaDB Server and client programs, using yum:

yum install MariaDB-server MariaDB-client

You can install various programming languages libraries for MySQL, they are completely compatible. For example, for PHP:

yum install php-mysql

Now, you need to start the installed MariaDB server and proceed to its settings:

service mysql start

If you’ve done everything correct, you’ll see the following message:

First starting of MariaDB server

Setting up MariaDB

To start working with MariaDB normally, you will need to set up the root password. I will provide details regarding tuning and optimization in a separate article, these are not the top-priority matters.

Initial setting of the root password for MySQL:

The easiest way to set up the root password is to use a special script, which is included into MariaDB distro:


Follow the instructions and set up the root password. 
If you have any questions left or need details – please, ask a question or leave a comment.
I’m always glad to help you!
Good luck!

answered Jul 28, 2016 by Expert Brian (5,410 points)
Welcome to Help Desk, here you can ask any questions and receive answers from our experts and other members of the community.

If you have any questions, please do not hesitate to contact our help desk!

Make a question!