ApsaraDB RDS for MySQL provides two approaches to back up and restore databases. Choose based on your scenario:
| Scenario | Recommended approach |
|---|---|
| Back up or restore a specific database | Use mysqldump |
| Restore all data from a backup set | Use a backup set |
| Your instance supports individual database and table restore | Restore individual databases and tables |
| Your instance does not support individual restore and you use Database Backup (DBS) | Restore data by database or table |
Individual database and table restore in the RDS console is supported on:
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 on RDS High-availability Edition
Use mysqldump to back up and restore a database
mysqldump exports a single database to a SQL file. Use this approach when you need a portable, database-level backup that you can restore to the same or a different instance.
Prerequisites
Before you begin, ensure that you have:
An Elastic Compute Service (ECS) instance running Linux, with network access to your RDS instance
The RDS instance endpoint, port, and database name
An RDS account authorized to manage the target database
If you encounter permission errors when using certain mysqldump functions, use the privileged account of your RDS for MySQL instance instead. For more information, see RDS MySQL mysqldump options.
Step 1: Install the MySQL client
On the ECS instance, run:
yum install mysqlAlternatively, download and install a specific version:
wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm
sudo rpm -ivh http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpmStep 2: Back up the database
Run the following command to export the database to a SQL file:
mysqldump -h <host> -u <user> -P <port> -p --opt --default-character-set=utf8 --triggers --hex-blob <database-name> > /tmp/db_name.sqlReplace the placeholders with your values:
| Placeholder | Description | Example |
|---|---|---|
<host> | Endpoint of your RDS instance | rm-xxx.mysql.rds.aliyuncs.com |
<user> | Account authorized to manage the database | myuser |
<port> | Port number of your RDS instance | 3306 |
<database-name> | Name of the database to back up | mydb |
Enter the account password when prompted. After the backup completes, the output looks similar to:

Verify the backup file was created:
ll /tmp/db_name.sqlStep 3: Restore the database (optional)
To restore the database from the SQL file, run:
mysql -h <host> -u <user> -P <port> -p <database-name> < /tmp/db_name.sqlUse the same placeholder values as in Step 2. Enter the account password when prompted. After the restore completes, the output looks similar to:

Use a backup set to restore instance data
RDS backup sets contain all data in your instance. To restore from a backup set, create a new RDS instance from the backup, then migrate the data back to the original instance.
This approach restores the entire instance. To restore only specific databases or tables, use mysqldump or the individual database and table restore feature if your instance configuration supports it.Step 1: Create a new instance from a backup set
Log on to the ApsaraDB RDS console and find your RDS instance.
Click the instance ID to open the instance details page.
In the left-side navigation pane, click Backup and Restoration.
Find the backup set to restore from, then click Restore in the Action column.
Follow the prompts to create a new RDS instance from the backup set.
Step 2: Verify the restored data
After the new instance is ready, connect to it and verify that the data is correct and complete.
Step 3: Migrate data to the original instance
After confirming the restored data is correct, migrate the required data from the new RDS instance back to the original instance. See Migrate data between RDS instances for instructions.
Post-restore checklist
After the restore is complete, verify the following:
[ ] Applications can connect to the correct instance using the right endpoint and credentials
[ ] Database accounts and permissions are correctly configured on the restored instance
[ ] Network access rules (whitelists, VPC settings) allow your applications to reach the instance
[ ] Monitoring and alerting are configured for the restored instance