MariaDB is one of the globally accepted database servers in the world. It is made by the MySQL developers and guaranteed to stay open source. MariaDB is an enhanced replacement for MySQL. MySQL 5.1 is compatible with MariaDB 5.1, 5.2, and 5.3 and also the MySQL 5.5 is compatible with MariaDB 5.5 too. It includes the XtraDB storage engine for replacing InnoDB. MariaDB is developed as open source software and as a relational database, it provides an SQL interface for accessing data. The latest versions of MariaDB includes GIS and JSON features. In this tutorial let’s have a look into how we can replace the existing MySQL with MariaDB.
1) Login to your server via SSH as root.
# ssh root@IPaddress
2) To avoid data loss, take a backup of the existing mysql data.
# cp -Rf /var/lib/mysql /var/lib/mysql_backup
# mv /etc/my.cnf /etc/my.cnf.backup
3) Make sure that you have disabled the targets so that cPanel won’t handle MySQL updates.
# /scripts/update_local_rpm_versions –edit target_settings.MySQL50 uninstalled
# /scripts/update_local_rpm_versions –edit target_settings.MySQL51 uninstalled
# /scripts/update_local_rpm_versions –edit target_settings.MySQL55 uninstalled
4) Now you have to remove all the MySQL RPM’s from the server.
# /scripts/check_cpanel_rpms –fix –targets=MySQL50,MySQL51,MySQL55
5) You have to create a Yum repository for MariaDB, create a file name “MariaDB.repo” inside the directory /etc/yum.repos.d/
# vi /etc/yum.repos.d/MariaDB.repo
Paste the following entries inside the newly created file.
[mariadb]name = MariaDB
baseurl = http://yum.mariadb.org/5.5.34/centos7-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
6) After the above steps let install the MariaDB now.
# yum install MariaDB-server MariaDB-client MariaDB-devel
7) Now start the MySQL service.
# systemctl start mysql.service
8) Then upgrade the mysql.
# mysql_upgrade
9) After the upgrade restarts the mysql service.
# systemctl restart mysql.service
10) At last, recompile Apache with PHP to finish the replacement.
# /scripts/easyapache –build
Hence we have replaced MySQL with MariaDB. You can verify it by executing the following command.
# mysql -V
If you need any further assistance please contact our support department.