How to safely upgrade to MySQL 8.0 ?

on

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.

7 thoughts on “How to safely upgrade to MySQL 8.0 ?

  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>

Leave a 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.

recent

Last Tweets

Locations of visitors to this page
categories