When we need to upgrade from MySQL 5.7 to MySQL 8, we could choose to do an in-place upgrade or set up another MySQL 8 server(s) from the existing running MySQL 5.7 replica.

This article will explain how to set up MySQL 8 as a replica from an existing MySQL 5.7 server with Percona XtraBackup.

In my lab, we have two test nodes:

0. Pre-flight check with MySQL upgrade checker utility

Let’s run the MySQL upgrade checker utility to verify whether MySQL 5.7 server instances are ready for an upgrade.

For details about MySQL Upgrade Checker,  please refer to Upgrading to MySQL 8? Meet the MySQL Shell Upgrade Checker Utility or mysql-shell-utilities-upgrade for details.

First, let’s try streaming copy from mysql57 to mysql8 server as this does not need additional storage.

1. On the replica mysql8 server, run:

The above command would be there to receive the backup until the stream copy was done.

2. On primary server mysql5.7, stream copy to mysql8 server:

3. Prepare the backup on MySQL 8 with Percona XtraBackup 8.0, but you will get this error – [Xtrabackup] Unsupported redo log format 1] because of the version incompatible issue.

4, You need to uninstall percona-xtrabackup-80 and install percona-xtrabackup-24 on the MySQL 8 server.

Then, prepare the backup on the mysql8 server,

5. You could start the MySQL service on MySQL 8 server now, and MySQL 8 will upgrade for you.

You will get the server upgrade from ‘50700’ to ‘80031’ completed, as below:

6. You could set up replication with the steps below.

For now, we have set up the replication, and you could uninstall Percona XtraBackup 2.4 and reinstall Percona XtraBackup 8.0 for future backups on the MySQL 8 server.

If you feel that’s annoying, you could choose to prepare the backup first on the mysql57 server, but this might need additional storage. Please see below.

#1 Take the backup on mysql5.7

#2. Prepare the backup on mysql57, then transfer to the mysql8 server.

Then transfer to mysql8:

 #3: Start MySQL service, and it will upgrade for you.

#4. Set up replication, similar to step 6 above:

Conclusion

You could either use Percona XtraBackup 2.4 to prepare the MySQL 5.7 backup on MySQL 8 servers after the stream copied, or use Percona XtraBackup 2.4 and prepare the backup on MySQL 5.7 first and then transfer to MySQL 8. Finally, let MySQL 8 binary upgrade it automatically for you.

I hope this is helpful for you to upgrade from MySQL 5.7 to MySQL 8  with Percona XtraBackup!

Percona XtraBackup is a free, open source, complete online backup solution for all versions of Percona Server for MySQL and MySQL. It performs online non-blocking, tightly compressed, highly secure backups on transactional systems so that applications remain fully available during planned maintenance windows.

Try Percona XtraBackup today!

Subscribe
Notify of
guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Mike F

Would you follow this practice for a replication cluster. We have 3 production servers that use replication 1->2->3->1…

We want to upgrade to MySQL 8.0