« Free web hosting will be stopped | Main | Transfering huge cPanel account to new server »
May 08, 2006
Downgrading MySQL from 4.1.X to 4.0.X
Assuming that you are using cPanel/WHM as a control panel to manage your web hosting server and have kept updates to automatic, cPanel will automatically upgrade you to MySQL 4.1. Many of the applications may not run properly in MySQL 4.1 unless they are modified and made compatible with MySQL 4.1. If you choose to downgrade back to MySQL 4.0.xx you should do the following.
MySQL 4.0 option is only available with cPanel stable build 114 or earlier, so make sure you downgrade to cPanel S114. Make backup of all accounts via WHM backup script.
Following are the steps
1. Login into shell and type /scripts/pkgacct cPanelUserName. Replace cPanelUserName with the actual username. Do this for all the accounts to take a backup. Keep the backups in safe place like a secondary drive or remote FTP. You can automate this process by configuring WHM backup option and then typing /scripts/cpbackup from SHELL.
2. Now we have to export all the databases in MySQL 4.0 format before we can actually start the process of downgrading. Use the following command to export the database.
mysqldump -u root -p --create-options --compatible=mysql40 db_name > db_name.sql
It will prompt you for a password. Enter the MySQL root password. Please note, MySQL root password is different from server root password. If you are unsure of its value, you can reset it from WHM. Do the above command for each database in your system.
3. Now that we have exported all databases in MySQL 4.0 compatible mode, its time to downgrade the server to MySQL 4.0.xx. Login into WHM as root and goto Tweak Settings. Select MySQL 4.0 option and click save. It will prompt you to click on a link after 30 seconds. So we wait for 30 seconds and click on the link.
4. WHM will downgrade MySQL to version 4.0. Once that is done, run /scripts/easyapache from SHELL prompt.
5. Now its time to import all database files back into the system. Use the command below to do so. Make sure you are in the same directory where the database sql files have been exported to.
mysql -u root -p db_name < db_name.sql
It will prompt you for a password, enter the MySQL root password. Repeat the command for all the databases in the system.
6. Restart MySQL and Apache servers. We have successfully downgraded to MySQL 4.0 from MySQL 4.1
If for some reasons the downgrade does not work, you can again upgrade back to MySQL 4.1 and restore the accounts from the backup. Hence it is very important to take a backup of the database both in MySQL 4.1 and MySQL 4.0 format.
Posted by manish at May 8, 2006 10:34 AM