First, you’ll follow a simple best practice: ensuring the list of available packages is up to date before installing anything new:
yum -y update
Now find which repo you should use with the MariaDB repository generator. We’re going to add the CentOS 6 (64 bit) MariaDB 5.5 repository.
vim /etc/yum.repos.d/MariaDB55.repo
# MariaDB 5.5 CentOS repository list – created 2014-10-03 15:57 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
Then exit and save the file with the command :wq .
Stop MySQL:
service mysqld stop
Remove the existing MySQL packages:
yum -y remove mysql-server mysql
Step #3: Install MariaDB
At this point, installing MariaDB is as simple as running just one command:
yum -y install mysql-server mysql
And then start MySQL, now MariaDB, again:
service mysql start
Run mysql_upgrade:
mysql_upgrade
Verify MySQL is now MariaDB by using the command client:
mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.39-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.