How to Replace MySQL with MariaDB In Cpanel

Replace MySQL with MariaDB

MariaDB An enhanced, drop-in replacement for MySQL. There are many companies replaced mysql for ensuring optimum availability and performance.

cPanel doesn’t support MariaDB, so we recommend only experienced systems administrators perform the above and we are not responsible for any possible data loss.

To replace the cPanel-provided MySQL installation with MariaDB, perform the following steps:

Run the following commands to back up your existing MySQL data:

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

Run the following commands to disable the MySQL RPM targets. cPanel & WHM will no longer handle MySQL updates, and the rpm.versions system will mark the associated MySQL RPMs as uninstalled.

/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 
/scripts/update_local_rpm_versions --edit target_settings.MySQL56 uninstall

 

Run the following command to remove the existing MySQL RPMs from your server. This will leave a clean slate for the MariaDB installation.

/scripts/check_cpanel_rpms --fix --targets=MySQL50,MySQL51,MySQL55,MySQL56 

You will see a message that is similar to the following output:

[20130218.235953]   
[20130218.235953]   The following RPMs are unneeded on your system and should be uninstalled:
[20130218.235953]   MySQL51-devel.5.1.68-1.cp1136
[20130218.235953]   MySQL51-test.5.1.68-1.cp1136
[20130218.235953]   MySQL51-shared.5.1.68-1.cp1136
[20130218.235953]   MySQL51-client.5.1.68-1.cp1136
[20130218.235953]   MySQL51-server.5.1.68-1.cp1136
[20130218.235953]   Removing 0 broken rpms:
[20130218.235953]   rpm: no packages given for erase
[20130218.235953]   No new RPMS needed for install
[20130218.235953]   Uninstalling unneeded rpms: MySQL51-devel MySQL51-test MySQL51-shared MySQL51-client MySQL51-server
[20130219.000004]   Shutting down MySQL........ SUCCESS!

Run the following command to create a yum repository for MariaDB:

vi /etc/yum.repos.d/MariaDB.repo

Enter the following contents for the /etc/yum.repos.d/MariaDB.repo file:

Where VERSION represents the currently-available version of MariaDB. For example, if the current version is 5.5.40, then the MariaDB.repo file would contain:

Use your preferred text editor to open the /etc/yum.conf file and remove php* and mysql* from the exclude line. The exclude line in your /etc/yum.conf file may appear similar to the following example:

exclude=bind-chroot courier* dovecot* exim*
filesystem httpd* mod_ssl* mydns* mysql* nsd* php* proftpd* pure-ftpd*
ruby* spamassassin* squirrelmail* 

Run the following commands to install MariaDB and restart the appropriate services

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

Run the following command to rebuild EasyApache’s PHP to ensure that all PHP modules remain intact:

/scripts/easyapache --build

Replace MySQL with MariaDB

Problem: I am getting “ERROR 1226 (42000): User ‘root’ has exceeded the ‘max_user_connections’ resource (current value: -1)” error when run mysql_upgrade. How can I solve this?

Answer: Run following command
# service mysql restart --skip-networking --skip-grant-tables
# mysql_upgrade
# service mysql restart

orginal post here

Leave a Reply

Your email address will not be published. Required fields are marked *