How to safely upgrade to MySQL 8.0 ?

As for each previous version, to upgrade to MySQL 8.0 you must first read the upgrade section in the manual. It’s important to know that you should upgrade without skipping a major version, so upgrade from 5.6 to 8.0 is not supported neither recommended.

Please also note that upgrades from any MySQL 8.0 RC won’t work. We support upgrade process only from GA versions.

Then one of the most important section to be aware of, is the incompatibility changes brought with the new version.

Once you have read the upgrade section in the manual and the release note of the version you want to install, with MySQL 8.0 and its new MySQL Shell, we developed an utility that will perform the checks to verify if your dataset and current configuration are compatible with the new MySQL 8.0.

Let’s try it !

In this example we have MySQL 5.7.21 running, the following packages are installed:

[root@mysql2 ~]# rpm -qa | grep mysql
mysql57-community-release-el7-11.noarch
mysql-community-client-5.7.21-1.el7.x86_64
mysql-community-devel-5.7.21-1.el7.x86_64
mysql-community-libs-5.7.21-1.el7.x86_64
mysql-community-server-5.7.21-1.el7.x86_64
mysql-community-common-5.7.21-1.el7.x86_64
mysql-community-libs-compat-5.7.21-1.el7.x86_64

Nothing special… now my first step (after having read the manual of course 😉 ) is to download and install the new MySQL Shell 8.0.x:

[root@mysql2 ~]# rpm -ivh mysql-shell-8.0.4-0.1.rc.el7.x86_64.rpm

Now we can run the Shell and connect to our server:We are connected to our MySQL 5.7.21 and now we will use the util global object to verify if we can upgrade to 8.0.4 RC. For your information, MySQL Shell provides 5 global objects:

===== Global Objects =====
dba        Enables you to administer InnoDB clusters using the AdminAPI.
mysql      Used to work with classic MySQL sessions using SQL.
mysqlx     Used to work with X Protocol sessions using the MySQL X DevAPI.
shell      Gives access to general purpose functions and properties.
sys        Gives access to system specific parameters.
util       Global object that groups miscellaneous tools like upgrade checker.

So let’s use the util one:

OK, as we can see we have a problem with one table still using utf8mb3, which might be common in 5.7. This is not a fatal error and the charset will be converted to utf8 automatically during the upgrade process.

The upgrade on itself is easy, on this example, I’m still using rpms and the yum repository associated to my distro:

[root@mysql2 ~]# yum update --enablerepo=mysql80-community mysql-community-server

Et voilĂ  ! Upgrade done successfully, don’t forget to run mysql_upgrade 😉

Conclusion

When you plan to upgrade to MySQL 8.0, please read the related sections in the manual, read the release notes and since 8.0.4RC, use the MySQL Shell to verify that your upgrade is possible.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

13 Comments

  1. Brand new 5.7.21 install on AWS:

    [root@ip-172-30-0-179 ~]# yum install https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
    [root@ip-172-30-0-179 ~]# yum install mysql-server mysql-shell
    [root@ip-172-30-0-179 ~]# systemctl start mysqld
    [root@ip-172-30-0-179 ~]# mysqlsh

    mysql-js> \c root@127.0.0.1
    Creating a Session to ‘root@127.0.0.1’
    Enter password:

    mysql-js> util.checkForServerUpgrade()
    ReferenceError: util is not defined
    mysql-js>

  2. I am working on upgrading MySQL 5.7.17 to MySQL 8.0 on Windows,
    I have downloaded the MySQL 8.0 Version,
    extract the files,
    Copy the 5.7 binaries in New Folder,
    Rename the folder,
    Start the service,
    *Unable to see the databases after starting the service.

    Could you please provide the step by step action for upgrading MySQL 5.7 to 8.0

  3. […] The subsequent step of upgrading from 5.7 to 8.0 is covered in depth in the MySQL 8.0 Reference Manual, with further details and examples in two blog posts from the MySQL Server team blog: INPLACE upgrade from MySQL 5.7 to MySQL 8.0 and Upgrading to MySQL 8.0? Here is what you need to know
 And finally, a highly practical how-to from lefred, everyone’s favourite MySQL Evangelist: How to safely upgrade to MySQL 8.0? […]

Leave a Reply to lefredCancel Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

As MySQL Community Manager, I am an employee of Oracle and the views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

You can find articles I wrote on Oracle’s blog.