How to replace MySQL with PerconaDB on a cPanel server

Percona Server is an enhanced drop-in replacement for MySQL.

Features of PerconaDB
>> Your queries will run faster and more consistently.
>> You will consolidate servers on powerful hardware.
>> You will delay sharding, or avoid it entirely.
>> You will save money on hosting fees and power.
>> You will spend less time tuning and administering.
>> You will achieve higher uptime.
>> You will troubleshoot without guesswork.

Some more,
>> Higher number of INFORMATION_SCHEMA Tables
>> Higher number of Global Performance and Status Counters
>> Per-Index Performance Counters
>> Per-User Performance Counters
>> Per-Client Performance Counters
>> High-Resolution Process List Timing
>> Fast Checksum Algorithm
>> Buffer Pool Pre-Load
>> Support for FlashCache
>> Import Tables From Different Servers

Steps to replace MySQL with MariaDB

1. To be secure with our current data, make sure to take a backup:

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

2. Disable the targets so that cPanel won’t handle 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

3. Remove all the MySQL RPMs from the server

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

The above command will uninstall all the MySQL RPMs from the server.

4. Create Yum repository for PerconaDB

Create a file “PerconaDB.repo”.

# vi /etc/yum.repos.d/PerconaDB.repo

Add the following entries,

[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

5. Remove php from “exclude” list in /etc/yum.conf

6. Install PerconaDB-sever, PerconaDB-client, PerconaDB-devel

# yum install Percona-Server-client-55 Percona-Server-server-55 Percona-Server-devel-55

7. Start MySQL

# /etc/init.d/mysql start

8. Then, run mysql_upgrade

# mysql_upgrade

9. Restart MySQL

# /etc/init.d/mysql restart

10. Add PHP back to the /etc/yum.conf file in “exclude” list

11. Recompile Apache with PHP

# /scripts/easyapache --build
/etc/init.d/mysql status
 SUCCESS! MySQL (Percona Server) running (9425)

That’s it 🙂 🙂

Related Links:
How to replace MySQL with MariaDB on a cPanel server
How to upgrade MySQL from 5.1 to 5.5 in a cPanel server – command line option

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

3 thoughts on “How to replace MySQL with PerconaDB on a cPanel server

  1. Ur forgetting a IMp step after

    /etc/init.d/mysql restart

    U have to run this
    ln -s /usr/lib64/libperconaserverclient.so /usr/lib64/libmysqlclient.so

    Or else u will get error in easyapache built

Leave a Reply

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