Friday 25 April 2014

Replace MySQL with MariaDB on a cPanel server

Replace MySQL with MariaDB on a cPanel server
MariaDB is a drop-in replacement for MySQL with more storage engines, speed improvements, extensions, new features and truly Open Source. (Source:http://www.mariadb.com)

Below you will find some steps on how to affectively stop cPanel/WHM from maintaining MySQL and begin utilizing MariaDB for any and all database activity on your server.

Note: This guide is supported for cPanel version 11.36 or higher and MySQL version 5.5.x

Step 1: Backup existing MySQL data

Make sure to save all existing data just in case there are any issues.

Code:
Code:
cp -Rf /var/lib/mysql /var/lib/mysql-old
mv /etc/my.cnf /etc/my.cnf-old

Step 2: Disable the targets so cPanel no longer handles MySQL updates

The following will mark the versions of MySQL we distribute as uninstalled so they are no longer maintained by cPanel/WHM

Code:
Code:
/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


Step 3: Remove existing MySQL RPM’s so theres a clean slate for MariaDB

Important: The below command will uninstall the MySQL RPM’s! 
Code:
Code:
/scripts/check_cpanel_rpms --fix --targets=MySQL50,MySQL51,MySQL55

Step 4: Create a yum repository for MariaDB

Code:
Code:
nano /etc/yum.repos.d/MariaDB.repo
Place the following inside of it.

Code:
Code:
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5.34/centos6-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1


Step 5: Remove php from the /etc/yum.conf file
Code:
Code:
nano /etc/yum.conf

then run the following commands

Code:
Code:
yum -y install MariaDB-server MariaDB-client MariaDB-devel
/etc/init.d/mysql start
mysql_upgrade
/etc/init.d/mysql restart

Step 5: Add php back to the /etc/yum.conf file
Code:
Code:
nano /etc/yum.conf
to ensure future php updates don’t get clobbered

Final Step: Rebuild easyapache/php to ensure modules are intact/working

Code:
Code:
/scripts/easyapache --build

No comments:

Post a Comment