Upgrade MySQL to MariaDB on a cPanel server

It is recommended to keep server software updated to latest version.  Default cPanel comes with MySQL 5.6 and it will become end of life on February 28, 2018 so i highly recommend to upgrade it to MariaDB 10.2,  MariaDB 10.1 or MariaDB 10.0.  MariaDB 10.2 is the latest version so here we are going to Upgrade MySQL to MariaDB on a cPanel server. If you already have database on the server take a copy of /var/lib/mysql and dump of all databases. You can use this using below commands.

cp -rvf /var/lib/mysql /var/lib/mysql_backup

And take dump of all database using

mysqldump --all-databases > all-databases.sql

If you want to take individual backup of the database run the command

mkdir /home/mysqlbackup/
 for i in `echo "show databases;" | mysql | grep -v Database`; do mysqldump $i > "/home/mysqlbackup/$i.sql"; done

This will create backup of database individually under /home/mysqlbackup/ make sure to create the directory before running the script.

Upgrade MySQL to MariaDB on a cPanel server

Login to WHM  >> Home »Software »MySQL/MariaDB Upgrade
Step 1

Here current version is MySQL 5.6 click next after selecting MariaDB 10.2
Upgrade mysql to mariadb on cpanel server

Upgrade mysql to mariadb on cpanel server from whm interface.

Step 2

On step 2 WHM will show couple of warning you need to tick all of them to go to next step.

Please click the checkbox next to each warning to indicate that you understand the potential consequences of this upgrade.

System Specific Warnings
Severity Message
General Warnings
Severity Message

Step 3

On the step 3 it will ask you if you want

Unattended Upgrade or Interactive Upgrade if you are not a server administrator just select Unattended Upgrade WHM will do everything for you.

When you click next WHM will start MySQL upgrade.

In some cases Innodb will during the upgrade in that case you need to recover innodb manually or restore the backup we have taken,

Once the restoration completes it will show “MariaDB upgrade completed successfully” we have completed Upgrade MySQL to MariaDB on a cPanel server

Once everything is done you can verify new MariaDB installation using the below command

[root@server ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2644
Server version: 10.1.32-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

If you can see above output everything is done and MariaDB is working fine.

Leave Comment

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