NOTE: If you have any doubts about this process please talk to a systems admin before proceding because massive data loss can occur!!!
You have been warned…
Downgrading the version of mysql on a cPanel server is something that is not usually done. To accomplish downgrading the version of mysql, the current version needs to be completely removed and then the desired version can be reinstalled. The issue with this is that in doing this ALL mysql data that a server contains will be removed. A complete backup of this data MUST be saved before downgrading, however restoring from these backups is very time consuming.
For Mysql 5 to Mysql 4 downgrades please do the following: (Downgrading mysql5 to mysql4 will cause the databases to not function properly in mysql4 if they were created or imported to mysql5, so running this loop *should* create copies compatible with mysql 4 or 4.1, however it may not work 100% of the time.
cp -R /var/lib/mysql /var/lib/mysql.bk
we have just copied a full mysql backup of all of the databases to mysql.bk and created another folder for the databases we are going to convert over using the command below
for each in `find /var/lib/mysql -type d|cut -d '/' -f5`; do mysqldump --compatible=mysql40 $each > /backup/mysql/$each.sql; done
Tweak as necessary for your backup location, I chose /backup/mysql as the secondary location. Next we are going to edit
(or 4.0, situation depending)
From there on out it should be the same as an upgrade: mysqlup, easyapache and reload the perl module. Next Run
/scripts/mysqlup --forcevia ssh to get cPanel to upgrade the MySQL software.
Once that is complete then run
/scripts/easyapache in order to get apache to be recompiled with the updated version of mysql.
Once easyapache is finished there is a particular perl module that will need to be reinstalled using this:
/scripts/perlinstaller --force Bundle::DBD::mysql
You should now see the correct version when you run
mysql Ver 14.12 Distrib 4.1.22, for pc-linux-gnu (i686) using readline 5.1
if something did not work, simply revert it back to mysql5 and start over. cPanel currently supports 3 different versions of mysql: 4.0, 4.1, 5.0 and 5.1. Upgrading the version of MySQL is a fairly simple process that can be done using the WHM interface:
1. Change to the desired version in the MySQL Upgrade section under Software in WHM. Click Next.
2. The next screen may have a number of warnings regarding the upgrade. Read each, and if you understand the consequences, click the checkbox next to each one until the Continue button is available. Click Continue
3. Next, you can choose between two methods of upgrading:
* Unattended will run through the upgrade without your intervention. If you want EasyApache to run automatically afterward, select Rebuild Apache and PHP automatically with last saved defaults.; Otherwise, select I will manually rebuild Apache and PHP when the MySQL upgrade is complete. . You must rebuild PHP afterward if you choose the second option.
* Interactive upgrade will walk you through each stage of the upgrade process. This requires your attention, so make sure you read through the instructions on-screen.
Or, you can begin with editing the cpanel.config via the command line and upgrade using the instructions listed above.