This topic describes how to restore the data of an ApsaraDB RDS for MySQL instance from a logical backup file to a self-managed MySQL instance by using the mysqldump plug-in of MySQL.
Prerequisites
- The RDS instance runs one of the following MySQL versions and RDS editions:
- MySQL 8.0 on RDS High-availability Edition (with local SSDs)
- MySQL 5.7 on RDS High-availability Edition (with local SSDs)
- MySQL 5.6
- MySQL 5.5
- A logical backup is complete on the RDS instance. For more information, see Enable automatic backups for an ApsaraDB RDS for MySQL instance.
- Tables in the RDS instance are not encrypted by using Transparent Data Encryption (TDE). If tables are encrypted by using TDE, errors occur during the restoration process. Before you restore the data of the RDS instance from a logical backup file, you must decrypt the encrypted tables. For more information, see Decrypt a table.
- For more information about how to restore the data of an ApsaraDB RDS for MySQL instance from a physical backup file to a self-managed MySQL instance, see Restore the data of an ApsaraDB RDS for MySQL instance from a physical backup file to a self-managed MySQL database.
- For more information about how to back up an ApsaraDB RDS for MySQL instance, see Back up the data of an RDS instance.
Runtime environment
The self-managed instance is installed in a 64-bit Linux operating system and runs the same MySQL version as the RDS instance. In this topic, Linux 7 and MySQL 5.7 are used as examples.
Procedure
FAQ
- Why does my RDS instance not have logical backup files?
By default, ApsaraDB RDS creates physical backups. You must manually create logical backups if required. For more information, see Enable automatic backups for an ApsaraDB RDS for MySQL instance.
- When I download a logical backup file, why is the value in the Backup Set Restore Point column displayed as 0 for the file?
ApsaraDB RDS for MySQL allows you to restore data to a specific point in time by using a physical backup file and a log backup file. The ApsaraDB RDS console provides the Backup Set Restore Point column. In this column, you can view the timestamp of each physical backup file. Logical backup files cannot be used to restore data to a specific point in time. The value in the Backup Set Restore Point column is 0 for all logical backup files.
- What do I do if the "
ERROR 1840 (HY000) at line 24: @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty.
" error message is displayed?This issue occurs due to GTIDs. You can use the following methods to resolve the issue:
- Enable the GTID feature. Then, repeat the steps in the "Procedure" section of this topic to restore the data.
- Do not enable the GTID feature. Comment out the GTID_PURGED parameter in the
.sql
file that you want to import. Then, repeat the steps in the "Procedure" section of this topic to restore the data. - Check that the synchronous replication mode is disabled. Log on to the self-managed
instance, run the
reset master
command, and then repeat the steps in the "Procedure" section of this topic to restore the data.
- What do I do if the "
ERROR 3546 (HY000) at line 26: @@GLOBAL.GTID_PURGED cannot be changed: the added gtid set must not overlap with @@GLOBAL.GTID_EXECUTED
" error message is displayed?The imported
.sql
file contains specific GTIDs that can be found in the self-managed instance. In this case, log on to the self-managed instance, run thereset master
command, and then repeat the steps in the "Procedure" section of this topic to restore the data. - After the data is restored to the self-managed instance, why is the data not automatically
synchronized to the secondary instance of the self-managed instance?
Check whether you can find the "
SESSION.SQL_LOG_BIN= 0
" setting at the end of the imported.sql
file. If the setting is specified, the data that is restored to the self-managed instance cannot be automatically synchronized to the secondary instance of the self-managed instance.