Downgrade MySQL Version

How to MySQL version downgrade (from 5.1 to 4.0) in a cPanel server.

We can easily Upgrade MySQL version from WHM: Main >> Software >> MySQL Upgrade. But there is no options available to Downgrade the MySQL version from WHM.

How ever we can downgrade MySQL version form command line in cPanel server.

You can follow the bellow given steps to MySQL version downgrade (from 5.1 to 4.0) in a cPanel server:

Pre-installation steps:

Before you downgrade the MySQL version you need to do the following steps so as to avoid data loss or file corruption

Check the MySQL version by using the following command

Code:
#rpm -qa |grep MySQL

Output

MySQL-server-5.0.91-0.glibc23
MySQL-client-5.0.91-0.glibc23
MySQL-devel-5.0.91-0.glibc23
MySQL-shared-5.0.91-0.glibc23
MySQL-bench-5.0.91-0.glibc23

Check the server OS:

Code:
# cat /etc/issue
or
# cat /etc/redhat-release

Output

CentOS release 5.5 (Final)

Server architecture check:

Code:
# arch

Output

x86_64

Before downgrading we need to backup MySQL databases so as to avoid data corruption so we are copying the mysql database folder by using the following command:

Code:
#cp -arp /var/lib/mysql /var/lib/mysql.bak

Then dump the mysql databases using the following command:

Code:
#mysqldump -u root -p(password) –all-databases > dumpfilename.sql

You can also take version compatible downgrade dump to check for any missing file restoring by using the following command:

Code:
#mysqldump -u root -p(password) –all-databases –compatible=mysql40 > versioncompatibledumpfilename.sql

Actual MySQL down-gradation

Then now we can start the down-gradation process:

First you need to open the cpanel.conf file and make changes to the MySQL-version line from 5.1 to 4.0 by following the using the command:

Code:
#vi /var/cpanel/cpanel.config

Output

Change the line
mysql-version=5.1 to mysql-version=4.0

After changing the MySQL version line from 5.1 to 4.0 in the configuration file we need to run the following command to force the MySQL up-gradation/Down-gradation:

Code:
#/scripts/mysqlup –force

Now the MySQL version down-gradation will take place, once the process is completed you can check the version of MySQL which will be:

Code:
# rpm -qa | grep -i mysql-

Output

MySQL-shared-4.0.27-0
MySQL-devel-4.0.27-0
MySQL-bench-4.0.27-0
MySQL-client-4.0.27-0
MySQL-embedded-4.0.27-0
MySQL-server-4.0.27-0

Restart MySQL services by using the following command:

Code:
#/etc/init.d/mysql restart

Now re-run apache build (easyapache) – so it can build php-mysql connector:

Code:
#/scripts/easyapache

That’s all the MySQL version has been downgraded successfully.

if you need for more help please contact us today https://pamirwebhost.com