Add to Favourites Add to Favourites    Print this Article Print this Article

Debian: Downgrading from MySQL 5.6 to 5.5

MySQL will have more luck in upgrading to newer versions rather than downgrading, as older versions don't always support the newer file formats.  As such, tasks such as downgrading from 5.6 to 5.5 can be a tricky task.

The main purposes for this guide is for Users of Debian 7, which don't want to use MySQL 5.6.  In this example, we'll downgrade to 5.5.35, but you can adjust the versions as needed.

This guide is for fresh installs, where no data has been added yet.
If you have already added data to the database, you must make backups of your databases, and restore them when the downgrade is finished.
Using the tool:

User Level -> Create/Restore Backups

will be easiest, as it would also restore the user/passwords and even let you only select the 2 database options for backup/restore, so other User data is less affected.  Raw mysqldumps/restores of the mysql.* databases won't work as well, because of the different formats.

This tasks isn't as suited to CustomBuild because this will be doing a wipe, and fresh install of the 5.5 version (sets up root and da_admin accounts), which CB does not do.

1) We'll need to download the 5.5 version:

cd /usr/local/directadmin/scripts/packages
wget http://files.directadmin.com/services/all/mysql/debian/64-bit/mysql-5.5.35-linux2.6-x86_64.tar.gz


2) Then we need to tell DA about the file, so it can find it for the install.  Edit:

/usr/local/directadmin/scripts/files.sh

Find the mysql_standard line, and set it to the new file:

mysql_standard=mysql-5.5.35-linux2.6-x86_64.tar.gz


3) Stop the old mysql and cleanup the leftovers.
- In DA, go to Admin Level -> Services Monitor -> mysqld: stop
- move the old data out of the way and ensure it's ready for re-install:

rm -f /usr/local/mysql
mv /home/mysql /home/mysql.old
rm -f /tmp/mysql.sock


4) Next, install it.  When asked to delete the old /home/mysql directory, you must answer "y" so we don't use the unsupported newer files.
You can specify any passwords you'd like, replace the bold values that you want to use:

cd /usr/local/directadmin/scripts
./mysql.sh rootpass da_admin daadminpass


5) After any changes to MySQL versions, it's recommended to recompile php:

cd /usr/local/directadmin/custombuild
./build php n





Related Information:

6) For future MySQL updates, you can use CustomBuild. Just make sure that the mysql= value in the options.conf is set to 5.5, to keep the same version family.

7) If you need to create a new tar.gz for MySQL, you can use the new force_mysql_compile option:

./build set mysql_force_compile yes
./build mysql

again, making sure the mysql= version in the options.conf is set as desired.  This should update to the latest version with a forced compile (instead of binary download, which doesn't always match up).
It should save the tar.gz to /usr/local, in case you need to use it for step #1 above.
It may also be stored in the /usr/local/directadmin/custombuild/mysql-5.5.35/mysql-5.5.35-linux2.6-x86_64.tar.gz path.

Was this answer helpful?

Also Read