How to replace MySQL with MariaDB in cPanel

What is 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.

Stop and disable the MySQL service

/etc/init.d/mysql stop

WHM >> Service Manager >> Uncheck MySQL >> Save


Backup existing MySQL data

We need to backup mysql data just in case there are any issues.

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


Disable the targets so cPanel no longer handles 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


Now Uninstall MySQL RPM’s so  theres a clean slate for MariaDB.

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

Create a yum repository for MariaDB

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

Add below lines if your server is CentOS 6 64bit.

# MariaDB 10.0 CentOS repository list - created 2014-10-31 11:41 UTC
name = MariaDB
baseurl =


Now install the MariaDB

yum install MariaDB-server MariaDB-client MariaDB-devel

Restart and update MariaDB

/etc/init.d/mysql start
/etc/init.d/mysql restart

Rebuild easyapache/php to ensure modules are intact/workingRebuild easyapache/php to ensure modules are intact/working
/scripts/easyapache --build

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