INPLACE upgrade from MySQL 5.7 to MySQL 8.0

MySQL 8.0 General Availability was announced in April and it comes with a host of new features. The overview about the new features and improvements made in MySQL 8.0 can be found in the following blog.

The server can be upgraded by performing either an INPLACE upgrade or LOGICAL upgrade.  The INPLACE upgrade involves shutting down the MySQL 5.7 server, replacing the old binaries with MySQL 8.0 binaries and then starting the MySQL 8.0 server on the old data directory.  The LOGICAL upgrade involves exporting SQL from the MySQL 5.7 version using a backup or export utility such as mysqldump or mysqlpump, installing the MySQL 8.0 binaries, and then applying the SQL to the new MySQL version.

The INPLACE upgrade is faster than the LOGICAL upgrade since it does not require loading of the databases after installing MySQL 8.0 version. Also while loading the databases during LOGICAL upgrade, errors might be encountered due to the incompatibilities which would require modifying the exported SQL file.

This blog post describes the simple steps to be followed for performing an INPLACE upgrade to MySQL 8.0.

  1. The first step in upgrading to MySQL 8.0 is checking the upgrade preparedness of the existing MySQL 5.7 server. We wanted this process to be simple for users and hence introduced a Upgrade Checker utility that comes with the MySQL Shell 8.0. The blog on Upgrade Checker describes how simple it is to run the utility and check if there are any actions that needs to be taken prior to upgrade. Let me run the utility against a running MySQL 5.7 server before attempting an upgrade to MySQL 8.0.

    The utility did not report any errors to be fixed. So I can proceed with the upgrade of the server to MySQL 8.0 by replacing the old binaries.
  2. At this point, take a backup of the data directory  using a backup or export utility such as mysqldump or mysqlpump. It is important to protect your data by creating a backup of your current databases which should include the mysql system database and log files.
  3. MySQL 8.0 binaries can be downloaded from here and the MySQL 8.0 server can be started on the old data directory. I have started with the default configuration here:
  4. The server is up and running, now I run the ‘mysql_upgrade’ to  check and upgrade all system tables and  also to check the user tables.

    The system tables have been upgrade and the user tables have been checked.
  5.  Let me start a client connection and check if all my old databases are present.
  6. Shutdown the server and start the server. Check the log file to ensure there are no errors reported.

This marks the completion of the INPLACE upgrade process. If the upgrade fails due to some errors, the server reverts all changes to the data directory. An attempt to upgrade again to MySQL 8.0 involves:

  • If any redo logs are present in the data directory, remove all of them.
  • Start the MySQL 5.7 server on the same data directory.
  • Fix all the errors that were reported during upgrade.
  • Perform an INPLACE upgrade to MySQL 8.0 again.

In my next blog, I will discuss about the possible issues that maybe encountered while performing upgrade to MySQL 8.0.  Meanwhile please review the upgrade prerequisites and the changes affecting upgrade to MySQL 8.0 prior to upgrade.

A detailed description about the upgrade process can be found in the MySQL documentation.  As always, Thank You for using MySQL!

About Nisha Gopalakrishnan

Nisha Gopalakrishnan has been working with MySQL database since 2012. She is working out of the Oracle office in Bangalore as a Senior Software Engineer. Her industry background has been system software development in database internals, file system and security.

4 thoughts on “INPLACE upgrade from MySQL 5.7 to MySQL 8.0

Leave a Reply

Your email address will not be published. Required fields are marked *

Please enter * Time limit is exhausted. Please reload CAPTCHA.