Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Migrate from Mysql to MariaDB in cPanel/WHM  (Read 1185 times)

0 Members and 1 Guest are viewing this topic.

vichithrakumart

  • Guest
Migrate from Mysql to MariaDB in cPanel/WHM
« on: March 08, 2018, 06:14:33 pm »
Step 1: Backup existing MySQL data

Code: [Select]
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

Code: [Select]
/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 there's a clean slate for MariaDB

Code: [Select]
/scripts/check_cpanel_rpms --fix --targets=MySQL50,MySQL51,MySQL55
Step 4: Create a yum repository for MariaDB

Code: [Select]
vi /etc/yum.repos.d/MariaDB.repo
Code: [Select]
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/[version]/[osdistro]/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Replace [version] with the equivalent of the version of MySQL you are running. Replace [osdistro] with the operating system you are utilizing.

Step 5: Remove php from the /etc/yum.conf file then run the following commands
Code: [Select]
yum 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 to ensure future php updates don’t get clobbered Final Step: Rebuild easyapache/php to ensure modules are intact/working

Code: [Select]
/usr/local/cpanel/scripts/easyapache --build