Switch to MariaDB on cPanel servers

Big on Hosting. Unlimited Space & Unlimited Bandwidth

Hello,

On most cases MariaDB is providing better performance than Mysql while standing with a good compatibility for scripts that made depending on Mysql .

Today i will learn you how to switch to MariaDB on cPanel server and try to fix compatibility issues "if happened" .

Let’s follow my instructions :
First we will make a backup of our Mysql files & databases :
1) Go to your WHM panel "Home » Service Configuration » Service Manager" .

2) Uncheck "MySQL Server" to disable and take it down until we finish our backup .

3) Connect to your server shell and do the following command to make an copy of all mysql files :

Code:

cp -r /var/lib/mysql /var/lib/mysql_backup


4) Go to your WHM panel "Home » Service Configuration » Service Manager"

5) Check "MySQL Server" again and save .

6) Go back to your server shell and do this command to take dump all databases in one file :

Code:

mysqldump --all-databases --force > /var/lib/mysql_backup/all-databases.sql


Now let’s go through the switching instructions :

1) Go to your WHM panel "Home » SQL Services » MySQL/MariaDB Upgrade"

2) Choose "MariaDB 10.2" from list and click on "Continue" button .

3) Check all boxes and click on "Continue" button .

4) Now you will see tow options to choose between just choose "Interactive Upgrade" to go through upgrading process for any exist database .

5) Click on "Continue" button and wait it to finish .

Remember that MariaDB 10.2.4+ strict mode is enabled by default so if you countered some compatibility issue on insert queries like this :

Code:

Field xxxx has no default value


Connect to your server shell and modify my.cnf by using the following command :

Code:

nano /etc/my.cnf


Then add the following line after "[mysqld]" section :

Code:

sql-mode = "NO_ENGINE_SUBSTITUTION"


Now restart MariaDB server to apply new configuration by using this command :

Code:

service mysql restart


That’s all .

Good luck

Source

Both comments and pings are currently closed.

Comments are closed.