What is the best backup method for MySQL 8.0?
This is Oniumi (@fat47) from the Service Reliability Group (SRG) of the Technology Headquarters.
#SRG(Service Reliability Group) is a group that mainly provides cross-sectional support for the infrastructure of our media services, improving existing services, launching new ones, and contributing to OSS.
This article is located in SRGDBWGWe will publish materials regarding the database provided by the DB Working Group for the entire company.
I hope this helps in some way.
IntroductionconclusionBackup MethodsmysqldumpmysqlpumpMySQL Shell Instance Dump Utility and Dump Loading UtilityPercona XtraBackupCLONE PLUGINBackup & Restore Speed ComparisonVerification databaseResulting graphmysqldumpmysqlpumpMySQL 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.
There is almost no difference in speed between XtraBackup and the Clone Plugin for physical backup and restore.
XtraBackup isMySQL 8.0.29 or laterSoMajor constraintsNote that
Backup Methods
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 can be executed to recreate the original schema objects, table data, or both. Other output formats available include CSV and other delimited text.
mysqlpump
It is included in the MySQL 5.7.8 package released in 2015 as the successor to mysqldump.
The 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 database files themselves.
CLONE PLUGIN
This is a physical backup feature added in MySQL 8.0.17 in 2019.
You can back up data locally as a file or create a copy of the target server remotely. Note that backup targets are limited to tables in the InnoDB storage engine.
Backup & Restore Speed Comparison
Verification 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 the number of 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 the 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 results
Run Time: 38 minutes 45 seconds
mysqlpump
Backup execution results
Run Time: 2 minutes 22 seconds
Restore execution results
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 results
Run Time: 15 minutes 35 seconds
Percona XtraBackup
Backup execution results
Run Time: 3 minutes 22 seconds
Restore execution results
Run Time: 3 minutes 41 seconds
CLONE PLUGIN
Backup execution results
Run Time: 3 minutes 56 seconds
Restore execution results
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 convenient features that allow you to create flexible backup plans.
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 fromThe InnoDB redo log format has also changed.
The default behavior when executing DDL has been changed to INSTANT, so to completely avoid this feature, you would need 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 back them up using XtraBackup.
To avoid this, as the error message states, 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 using 8.0.17 or later, where the CLONE PLUGIN can be used, you may want to consider using the CLONE PLUGIN.
Conclusion
SRG is looking for people to work with us.
If you're interested, please contact us here.