You can facilitate a server upgrade or downgrade by using MySQL Enterprise Backup to make a backup of your server data, restore it to a data directory, and start a different version of MySQL server on the old data. However, you may encounter technical challenges during a server upgrade or downgrade, and it is beyond the function of MySQL Enterprise Backup, as a backup tool, to ensure a successful server upgrade or downgrade. Users interested in the topic are advised to consult the MySQL server manual, especially the Upgrading MySQL and Downgrading MySQL sections.
Here are a number of things that users should pay attention to when restoring a backup with a database upgrade or downgrade:
Restoring a database to an older MySQL version (i.e., server downgrading) should only be performed when the original and the final server versions are in the same release series (for example, going from 5.7.21 to 5.7.20). Downgrading to a lower series (for example, from 5.7.21 to 5.6.39) might cause server crashes or data corruption.
Restoring a database to a newer MySQL version (i.e. server upgrading) requires the following steps, the skipping of which might crash the target server:
Back up the data on the older server.
Restore the data to the directory you plan to use as the newer server's data directory by running a
copy-back-and-apply-logoperation on the backup.
Restart the older server, using the intended data directory for the newer server as its own data directory. With this step, the older server prepares the data for an upgrade by performing some clean-up steps on the data, similar to what the server would do during a crash recovery.
Perform a slow shutdown for the older server by, issuing the
SET GLOBAL innodb_fast_shutdown=0statement and then shutting the server down. This will ensure that all dirty pages are flushed, and hence there will be no redo log processing for the newer server.
Install the newer server.
Start the newer server.
After performing these steps, check your data to make sure that your restore is successful.