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.
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.
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>
Hi Matthew,
As written in the blog post, you need at least mysql-shell 8.0.x to have the util object.
Cheers.
[…] And don’t forget that the new MySQL Shell includes a new utility checking your current environment to identify possible issues like the one covered in this article. […]
[…] run the utility to verify if the upgrade is possible (check this post) […]
[…] run the utility to verify if the upgrade is possible (check this post) […]
[…] Read More (Community […]
[…] we are moving from latin1 (default until MySQL 8.0.0) to utf8mb4 (new default from 8.0.1). In this post, Lefred refers to this change and some safety checks for upgrading. For our change, an important […]
[…] The following step is not mandatory but highly recommended. Before upgrading to MySQL 8.0, you should install the new MySQL Shell and see the new upgrade checker tool in action ! (see also this previous article) […]
[…] The following step is not mandatory but highly recommended. Before upgrading to MySQL 8.0, you should install the new MySQL Shell and see the new upgrade checker tool in action ! (see also this previous article) […]
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
Hi Baqar,
I just wrote this blog post for you: https://lefred.be/content/upgrading-from-mysql-5-7-to-8-0-on-windows/
Cheers,
[…] 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? […]
[…] This is the most common way to migrate from 5.7 to 8.0. You can follow this blog post. […]