MariaDB has more features and advantages over MySQL server described here. If you are thinking to switch to MariaDB, this article will help you. Today I am going to show you how to replace MySQL with MariaDB with all you existing Data in Linux CentOS. To do This we are going to follow these steps as root.
Step 1: Backup Existing Databases
Firstly take a backup of all existing databases, In case we need to restore it.
# mysqldump -u root -p --all-databases > BackupDBS.sql
Step 2: Remove MySQL
After confirming that you have all databases backup, Lets remove MySQL from system. Firstly Stop the MySQL Service
# service mysqld stop
We copy the MySQL Configuration File to a Different location to use
# cp /etc/my.cnf /tmp/
Remove all the MySQL Packages
# yum remove mysql*
Step 3: Install MariaDB
To Solve any dependency problem we install the REMI Repo.
# rpm –ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Then install the compat-mysql55 package
# yum –enablerepo=remi-test –disablerepo=remi install compat-mysql55
Now we can proceed with the installation of MariaDB. You can follow the Steps on https://tecadmin.net/install-mariadb-in-centos-rhel-and-fedora/
After we completed these steps we restore our my.cnf we backed up previously to its original location
# cp /tmp/my.cnf /etc/my.cnf
Step 4: Restore All Databases (If Required)
Restore the backup of all our databases in MariaDB server.
# mysql –u root –p < BackupDBS.sql
Finally we restart the service, log back in to MariaDB and check that all our data is indeed all there.
# service mysql restart # mysql –u –root –p