Upgrade MySQL to MariaDB on a cPanel server

Need professional assistance ? Checkout our cPanel Server Management plan, only $75 per month including 24×7 monitoring.

IMPORTANT: Take a full backup of your individual database and copy of /var/lib/mysql before taking backup. Make sure to stop mysql before taking backup of /var/lib/mysql

On a production servers every want to keep most uptodate software so that you can avoid the mess of upgrading packages later and avoid downtime on live websites. 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

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

Now we will start MySQL upgrade from Home »Software »MySQL/MariaDB Upgrade

Step 1

Here current version is 

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

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 49
Server version: 10.2.13-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 below output everything is done and MariaDB is working fine.

 

Need help with cPanel server management ? Check our cPanel server management plan