How to install MariaDB in cPanel

install mariadb cpanel

MariaDB Server – the world’s fastest growing open source database. It’s used by companies in mission-critical environments whilst ensuring optimum availability and performance. cPanel team doesn’t support MariaDB as of now but we can replace MySQL with MariaDB.

Stop and disable the MySQL service

/etc/init.d/mysql stop

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

Make copy of existing MySQL data in case something goes wrong

cp -Rf /var/lib/mysql /var/lib/mysql-backup
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

Uninstall MySQL

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

Install MariaDB

Create file /etc/yum.repo.d/mariadb.repo and add below lines if your server is CentOS 6 64bit.

# MariaDB 5.5 CentOS repository list - created 2014-01-05 00:39 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

For different OS get the repo lines from https://downloads.mariadb.org/mariadb/repositories/
Now install the MariaDB

yum install MariaDB-server MariaDB-client MariaDB-devel

Restart and update MariaDB

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

Rebuild easyapache/php to ensure modules are intact/working

/scripts/easyapache --build

Please check out our 24×7 cPanel Server Management Service plan if you want professional system administrator to do these tasks for you.