Child pages
  • How to Replace MySQL with Percona
Skip to end of metadata
Go to start of metadata

Overview

This document describes how to replace the cPanel-provided and cPanel-managed MySQL® installation with your own installation of Percona.

Warning:

This document describes an unsupported workaround that we do not guarantee will work in the future.

  • After you perform these steps on a server, the system administrator must manage and maintain the server's database software.
  • We recommend that only experienced system administrators attempt to perform these steps.
  • We are not responsible for any data loss that any attempts to perform these steps cause.

Replace MySQL with Percona

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

Important:

The innodb_log_file_size file's default setting in Percona version 5.5 and MySQL version 5.6.8 and earlier differs from MySQL version 5.6.8 and later. If your server runs MySQL version 5.6.8 and later, we strongly recommend that you perform the following actions before you replace MySQL with Percona:

  • Change the innodb_log_file_size file's size to match the /var/lib/mysql/ib_logfile0 file's size.
  • Change the innodb_log_file_size file's size to match the /var/lib/mysql/ib_logfile1 file's size.

To execute these changes, perform the following steps:

  1. Open the /etc/my.cnf file with a text editor.
  2. Edit the innodb_log_file_size line's setting to match the /var/lib/mysql/ib_logfile0 and the /var/lib/mysql/ib_logfile1 files' sizes. For example:

    performance-schema=0
    innodb_file_per_table=1
    innodb_buffer_pool_size=26214400
    innodb_log_file_size=50331648
    max_allowed_packet=268435456
    open_files_limit=10000
  1. Run the following commands to back up your existing MySQL data:

    cp -afv /var/lib/mysql /var/lib/mysql-old
    mv -v /etc/my.cnf /etc/my.cnf-old
  2. 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.

    /usr/local/cpanel/scripts/update_local_rpm_versions --edit target_settings.MySQL50 uninstalled
    /usr/local/cpanel/scripts/update_local_rpm_versions --edit target_settings.MySQL51 uninstalled
    /usr/local/cpanel/scripts/update_local_rpm_versions --edit target_settings.MySQL55 uninstalled 
    /usr/local/cpanel/scripts/update_local_rpm_versions --edit target_settings.MySQL56 uninstalled
    /usr/local/cpanel/scripts/update_local_rpm_versions --edit target_settings.MariaDB100 uninstalled
    /usr/local/cpanel/scripts/update_local_rpm_versions --edit target_settings.MariaDB101 uninstalled

    Note:

    We removed the MySQL50 and MySQL51 RPM Targets in cPanel & WHM version 68. 

  3. Run the following command to remove the existing MySQL RPMs from your server. 

    /usr/local/cpanel/scripts/check_cpanel_rpms --fix --targets=MySQL50,MySQL51,MySQL55,MySQL56,MariaDB100,MariaDB101

    Note:

    We removed the MySQL50 and MySQL51 RPM Targets in cPanel & WHM version 68. 

    You will see a message that resembles 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!  
  4. Run the following command to create a yum repository for Percona:

    vi /etc/yum.repos.d/Percona.repo 
  5. Enter the following contents for the /etc/yum.repos.d/Percona.repo file:

    [percona]
    name = CentOS $releasever - Percona
    baseurl=http://repo.percona.com/centos/$releasever/os/$basearch/
    enabled = 1
    gpgkey = http://www.percona.com/redir/downloads/percona-release/RPM-GPG-KEY-percona
    gpgcheck = 1 
  6. Use a 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* 
  7. Run the following commands to install Percona and restart the appropriate services:

    yum install Percona-Server-client-55 Percona-Server-server-55 Percona-Server-devel-55
    /usr/local/cpanel/scripts/restartsrv_mysql
    mysql_upgrade
    /usr/local/cpanel/scripts/restartsrv_mysql
  8. Run the following command to create a symlink:

    ln -sv /usr/lib64/libperconaserverclient.so /usr/lib64/libmysqlclient.so

    For more information about this symlink, read our How to Update a Percona Installation documentation

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

    /usr/local/cpanel/scripts/easyapache --build

Additional documentation