MySQL 5.6 Reference Manual Including MySQL NDB Cluster 7.3-7.4 Reference Guide
This section describes how to downgrade MySQL binary and package-based installations on Unix/Linux. In-place and logical downgrade methods are described.
In-place downgrade involves shutting down the new MySQL version, replacing the new MySQL binaries or packages with the old ones, and restarting the old MySQL version on the existing data directory.
In-place downgrade is supported for downgrades between GA releases within the same release series.
In-place downgrade is not supported for MySQL APT, SLES, and Yum repository installations.
To perform an in-place downgrade:
Review the information in Section 2.12.1, “Before You Begin”.
If you use XA transactions with InnoDB
,
run XA
RECOVER
before downgrading to check for
uncommitted XA transactions. If results are returned, either
commit or rollback the XA transactions by issuing an
XA
COMMIT
or
XA
ROLLBACK
statement.
If you use InnoDB
, configure MySQL to
perform a slow shutdown by setting
innodb_fast_shutdown
to
0
. For example:
mysql -u root -p --execute="SET GLOBAL innodb_fast_shutdown=0"
With a slow shutdown, InnoDB
performs a
full purge and change buffer merge before shutting down,
which ensures that data files are fully prepared in case of
file format differences between releases.
Shut down the newer MySQL server. For example:
mysqladmin -u root -p shutdown
After the slow shutdown, remove the
InnoDB
redo log files (the
ib_logfile*
files) from the
data
directory to avoid downgrade
issues related to redo log file format changes that may have
occurred between releases.
rm ib_logfile*
Downgrade the MySQL binaries or packages in-place by replacing the newer binaries or packages with the older ones.
Start the older (downgraded) MySQL server, using the existing data directory. For example:
mysqld_safe --user=mysql --datadir=/path/to/existing-datadir
Run mysql_upgrade. For example:
mysql_upgrade -u root -p
Shut down and restart the MySQL server to ensure that any changes made to the system tables take effect. For example:
mysqladmin -u root -p shutdown
mysqld_safe --user=mysql --datadir=/path/to/existing-datadir
Logical downgrade involves using mysqldump to dump all tables from the new MySQL version, and then loading the dump file into the old MySQL version.
Logical downgrades are supported for downgrades between releases within the same release series and for downgrades to the previous release level. Only downgrades between General Availability (GA) releases are supported. Before proceeding, review Section 2.12.1, “Before You Begin”.
For MySQL APT, SLES, and Yum repository installations, only downgrades to the previous release level are supported. Where the instructions call for initializing an older instance, use the package management utility to remove MySQL 5.6 packages and install MySQL 5.5 packages.
To perform a logical downgrade:
Review the information in Section 2.12.1, “Before You Begin”.
Dump all databases. For example:
mysqldump -u root -p --add-drop-table --routines --events --all-databases --force > data-for-downgrade.sql
Shut down the newer MySQL server. For example:
mysqladmin -u root -p shutdown
Initialize an older MySQL instance, with a new data directory. For example:
scripts/mysql_install_db --user=mysql
Start the older MySQL server, using the new data directory. For example:
mysqld_safe --user=mysql --datadir=/path/to/new-datadir
Load the dump file into the older MySQL server. For example:
mysql -u root -p --force < data-for-upgrade.sql
Run mysql_upgrade. For example:
mysql_upgrade -u root -p
Shut down and restart the MySQL server to ensure that any changes made to the system tables take effect. For example:
mysqladmin -u root -p shutdown
mysqld_safe --user=mysql --datadir=/path/to/new-datadir