What is the best way to back up MySQL 8.0?
This is Oniumi (@fat47) from the Service Reliability Group (SRG) of the Technology Headquarters.
#SRG(Service Reliability Group) mainly provides cross-sectional support for the infrastructure of our media services, improving existing services, launching new ones, contributing to OSS, etc.
This article is located in SRGDBWGWe will publish materials regarding the database that the (DB Working Group) provides to the entire company.
I hope this helps in some way.
IntroductionconclusionBackup TechniquesmysqldumpmysqlpumpMySQL Shell Instance Dump Utility and Dump Loading UtilityPercona XtraBackupCLONE PLUGINBackup & Restore Speed ComparisonTesting databaseGraph of resultsmysqldumpmysqlpumpMySQL Shell Instance Dump Utility and Dump Loading UtilityPercona XtraBackupCLONE PLUGINWhich backup tool should I use?Conclusion
Introduction
There are various backup methods available for MySQL 8.0, but we will consider which one is best to use.
conclusion
Logical backup and restoreMySQL Shell Dump Utilityis the fastest
Physical backup and restore is almost the same speed between XtraBackup and CLONE PLUGIN
XtraBackup isMySQL 8.0.29 or laterSoMajor ConstraintsNote that
Backup Techniques
There are several ways to perform a full backup:
- mysqldump
- mysqlpump
- Percona XtraBackup
- MySQL Shell Instance Dump Utility and Dump Loading Utility
- CLONE PLUGIN
mysqldump
The mysqldump client is a utility that performs logical backups.
It generates a set of SQL statements that you can run to recreate the original schema objects, table data, or both. Other output formats include CSV and other delimited text.
mysqlpump
It is the successor to mysqldump and is included in the MySQL 5.7.8 and later packages in 2015.
Differences from mysqldump include improvements such as progress display functionality and parallel processing capabilities.
MySQL Shell Instance Dump Utility and Dump Loading Utility
This feature was added to MySQL shell 8.0.21 in 2020.
In addition to performing backups in parallel, restores can also be performed in parallel.
MySQL Shell is also available for the 5.7 environment.
Percona XtraBackup
This is an open source backup tool released by Percona.
The backup tools mentioned so far are logical backups.
XtraBackup is a physical backup that copies the DB files themselves.
CLONE PLUGIN
This is a physical backup feature that was added in MySQL 8.0.17 in 2019.
You can back up locally as a file or create a copy of the target server remotely. Note that backup targets are limited to tables with the InnoDB storage engine.
Backup & Restore Speed Comparison
Testing database
MySQL Ver | 8.0.28 |
Data size | Approximately 42GB |
Resulting graph

First, I'll post a graph of the results. The vertical axis is seconds.
For logical backups, MySQL Shell Dump Utility is the fastest for both backup and restore.
For physical backups, there was no significant difference in speed between XtraBackup and CLONE PLUGIN.
The backup and restore commands and execution times for each tool are as follows.
mysqldump
Backup execution results
Run Time: 4 minutes 22 seconds
Restore execution result
Run Time: 38 minutes 45 seconds
mysqlpump
Backup execution results
Run Time: 2 minutes 22 seconds
Restore execution result
Run Time: 41 minutes 51 seconds
MySQL Shell Instance Dump Utility and Dump Loading Utility
Backup execution results
Execution result: 1 minute 51 seconds
Restore execution result
Run Time: 15 minutes 35 seconds
Percona XtraBackup
Backup execution results
Run Time: 3 minutes 22 seconds
Restore execution result
Run Time: 3 minutes 41 seconds
CLONE PLUGIN
Backup execution results
Run Time: 3 minutes 56 seconds
Restore execution result
Run Time: 3 minutes 52 seconds
Which backup tool should I use?
MySQL Shell dump utility
If you need logical backup data, such as when migrating from an on-premises environment to Aurora, I recommend using this MySQL Shell dump utility.
XtraBackup
XtraBackup has a long history and comes with a variety of useful features that allow you to create a flexible backup plan.
For example, you can use Stream to upload the backup data you have acquired directly to the object storage of a cloud service.
However, caution is required when using XtraBackup with MySQL 8.0.29 or later.
MySQL8.0.29The specification of ALTER TABLE … ALGORITHM=INSTANT has changed sinceThe InnoDB redo log format has also changed.
Because the default behavior when executing DDL has been changed to INSTANT, to completely avoid this feature, it would be necessary to specify ALGORITHM=INPLACE/COPY; for all DDL, which is not practical.
If there are tables that use this INSTANT function, you will not be able to perform a backup using XtraBackup.
To avoid this, as stated in the error message, you need to run OPTIMIZE TABLE or ALTER TABLE ALGORITHM=COPY on the target table.
Backups using XtraBackup should be limited to MySQL 8.0.28 or later.
If you are in an environment that uses 8.0.17 or later and can use the CLONE PLUGIN, you may want to consider using it.
Conclusion
SRG is looking for people to work with us. If you are interested, please contact us here.