2.11.2 Downgrading MySQL

2.11.2.1 Changes Affecting Downgrades from MySQL 5.6

This section describes how to downgrade to an older MySQL version.

Supported Downgrade Methods

Supported downgrade methods include:

Supported Downgrade Paths

Unless otherwise documented, the following downgrade paths are supported:

The following conditions apply to all downgrade paths:

Before You Begin

Before downgrading, the following steps are recommended:

Performing an In-place Downgrade

In-place downgrades are supported for downgrades between GA status releases within the same release series. Review Before you Begin before proceeding.

To perform an in-place downgrade:

  1. Review the changes described in Section 2.11.2.1, “Changes Affecting Downgrades from MySQL 5.6” for steps to be performed before downgrading.

  2. If you use InnoDB, configure MySQL to perform a slow shutdown by setting innodb_fast_shutdown to 0. For example:

    shell> bin/mysql -u root -ppassword --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.

  3. Shut down the newer MySQL server. For example:

    shell> bin/mysqladmin -u root -ppassword shutdown
  4. 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.

    shell> rm ib_logfile*
  5. Downgrade the MySQL binaries or packages in-place by replacing the newer binaries or packages with the older ones.

  6. Start the older (downgraded) MySQL server, using the existing data directory. For example:

    shell> bin/mysqld_safe --user=mysql --datadir=/path/to/existing-datadir
    
  7. Run mysql_upgrade. For example:

    shell> bin/mysql_upgrade -u root -ppassword

Performing a Logical Downgrade

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) status releases are supported. Review Before you Begin before proceeding.

To perform a logical downgrade:

  1. Review the changes described in Section 2.11.2.1, “Changes Affecting Downgrades from MySQL 5.6” for steps to be performed before downgrading.

  2. Dump all databases. For example:

    shell> bin/mysqldump --add-drop-table --events -u root -ppassword --all-databases --force > all_5_6_databases_dump.sql
  3. Shut down the newer MySQL server. For example:

    shell> bin/mysqladmin -u root -ppassword shutdown
  4. Initialize an older MySQL instance, with a new data directory. For example:

    shell> scripts/mysql_install_db --user=mysql
  5. Start the older MySQL server, using the new data directory. For example:

    shell> bin/mysqld_safe --user=mysql --datadir=/path/to/new-datadir
    
  6. Load the dump file into the older MySQL server. For example:

    shell> bin/mysql -u root -ppassword --execute="source all_5_6_databases_dump.sql" --force
  7. Run mysql_upgrade. For example:

    shell> bin/mysql_upgrade -u root -ppassword
  8. Configure MySQL to perform a slow shutdown by setting innodb_fast_shutdown to 0. For example:

    shell> bin/mysql -u root -ppassword --execute="set global innodb_fast_shutdown=0"
  9. Shut down and restart the MySQL server to ensure a clean shutdown and startup. For example:

    shell> bin/mysqladmin -u root -ppassword shutdown
    shell> bin/mysqld_safe --user=mysql --datadir=/path/to/new-datadir
    

Downgrade Troubleshooting

If you downgrade from one release series to another, there may be incompatibilities in table storage formats. In this case, use mysqldump to dump your tables before downgrading. After downgrading, reload the dump file using mysql or mysqlimport to re-create your tables. For examples, see Section 2.11.5, “Copying MySQL Databases to Another Machine”.

A typical symptom of a downward-incompatible table format change when you downgrade is that you cannot open tables. In that case, use the following procedure:

  1. Stop the older MySQL server that you are downgrading to.

  2. Restart the newer MySQL server you are downgrading from.

  3. Dump any tables that were inaccessible to the older server by using mysqldump to create a dump file.

  4. Stop the newer MySQL server and restart the older one.

  5. Reload the dump file into the older server. Your tables should be accessible.