How to replace MySQL with MariaDB in 11.36

Important: This setup is considered to be unsupported by the cPanel/WHM team. Please note that once cPanel/WHM no longer maintains MySQL on your system it is on the Systems Administrator to manage and maintain any updates and maintenance on the database software.  We recommend only experienced systems administrators perform the above and we are not responsible for any possible data loss.

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. MariaDB is “An enhanced, drop-in replacement for MySQL” (Source: www.mariadb.com). The guide found below is based around utilizing the new RPM tools we provide in 11.36.
Important Links
MariaDB Versus MySQL Compatibility
MariaDB Versus MySQL Features

Documentation on the RPM system provided by cPanel & WHM

Step 1: Backup existing MySQL data

Make sure to save all existing 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

 

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

/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! 
/scripts/check_cpanel_rpms --fix --targets=MySQL50,MySQL51,MySQL55
[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!

 

Step 4: Create a yum repository for MariaDB

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

place the following inside of it depending on the DISTRO (https://downloads.mariadb.org/mariadb/repositories/):

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

 

Step 5: Remove php from the /etc/yum.conf file then run the following commands

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

/scripts/easyapache --build

 

This entry was posted in Tips & Tricks and tagged , , , , , . Bookmark the permalink.
  • pleasesendmoney@gimmeabuck.com

    I don’t understand why cpanel would spend even one second writing a blog post on the official cpanel blog about how to install replace core cpanel supported software with unsupported software.
    This seems like something more appropriate for the forums somewhere…

    • http://www.cpanel.net/ Brian Oates

      Compared to the forums, the blog is a more direct and less cluttered way to compile together the various (un)supported guides that cPanel staff has put together. Despite that this particular guide is unsupported, cPanel is passionate at doing everything well. If it’s something our customers may try anyway in spite of MariaDB not having official support, there’s a lot of us here that like to put our knowledge and experience to work and come up with something that should at least reduce any complications experienced when those customers try it

      Something I also want to stress is that these articles do not detract from or lessen the time spent developing and improving our software.

  • http://www.facebook.com/ovidio.balan Cristian O. Balan

    MariaDB would be integrated into WHM/cPanel in the near future?

  • http://twitter.com/vbtechsupport GEORGE LIU

    Nice to have something semi-official from Cpanel folks. Thanks :)

    Feature request for MariaDB still one of the highest voted requests http://features.cpanel.net/responses/as-a-server-administrator-i-want-mariadb-support-so-that-i-can-accomodate-both-innodb-and-noninnodb-users :)

  • Connor Tumbleson

    Once we remove php from the exclusion yum.conf, do we add it back after we’ve completed the re-build of apache?

    • Sam

      Would lik to know the answer to this.

    • Jesse

      Hey @google-558abd4c43282f502545986422fcfc01:disqus, yes, that is correct. I’ve included this step in the guide. It shouldn’t give any issues but it will ensure future php updates don’t clobber the updates we provide. Thanks for pointing that out!

  • http://portofacil.net Janio Sarmento

    I tried this tutorial today, and I put down my server.

    One should be advised that recent versions of MariaDB DO NOT include some client libraries needed to run PHP (libmysqlclient.so.18, for example). It seems to me this tutorial could work for CentOS 6, but for CentOS 6 the server will not be usable.

    Or, otherwise, I missed some important detail, but I don’t think so.