This topic describes how to migrate data from a self-managed MySQL database to an ApsaraDB RDS for MySQL instance by using Data Transmission Service (DTS). DTS supports schema migration, full data migration, and incremental data migration. When you migrate data from a self-managed MySQL database to Alibaba Cloud, you can select all of the supported migration types to ensure service continuity.
Supported source and destination databases
You can use DTS to migrate data between the following types of MySQL databases. In this example, the source database is a self-managed MySQL database with a public IP address and the destination database is an ApsaraDB RDS for MySQL instance. You can also follow the procedure to configure data migration tasks for other types of MySQL databases.Source database | Destination database |
---|---|
|
|
Prerequisites
- The version of the self-managed MySQL database is 5.1, 5.5, 5.6, 5.7, or 8.0.
- If the source MySQL database is an on-premises database, the CIDR blocks of DTS servers must be added to the IP whitelist of the database. This setting ensures that DTS servers can access the source MySQL database. For more information, see Add the CIDR blocks of DTS servers to the security settings of on-premises databases.
- The destination ApsaraDB RDS for MySQL instance is created. For more information, see Create an ApsaraDB RDS for MySQL instance.
- The available storage space of the ApsaraDB RDS for MySQL instance is larger than the total size of the data in the self-managed MySQL database.
Limits
Category | Description |
---|---|
Limits on the source database |
|
Other limits |
|
Special cases |
|
Migration types
- Schema migration
DTS migrates the schemas of the required objects from the source database to the destination database.
Note- DTS supports schema migration for the following types of objects: table, view, trigger, stored procedure, and function.
- During schema migration, DTS changes the value of the SECURITY attribute from DEFINER to INVOKER for views, stored procedures, and functions.
- DTS does not migrate user information. To call a view, stored procedure, or function of the destination database, you must grant the read and write permissions to INVOKER.
- Full data migration
DTS migrates historical data of the required objects from the source database to the destination database.
- Incremental data migration
After full data migration is completed, DTS migrates incremental data from the source database to the destination database. Incremental data migration allows you to ensure service continuity when you migrate data between self-managed databases.
SQL operations that can be migrated
Operation type | SQL statements |
---|---|
DML | INSERT, UPDATE, and DELETE |
DDL |
|
Permissions required for database accounts
Database | Schema migration | Full data migration | Incremental data migration |
---|---|---|---|
Self-managed MySQL database | The SELECT permission | The SELECT permission | Full data migration: the SELECT permission on the objects to be migrated
The REPLICATION CLIENT, REPLICATION SLAVE, and SHOW VIEW permissions The permissions to create databases and tables. The permissions allow DTS to create a database named dts to record heartbeat data during migration. |
ApsaraDB RDS for MySQL instance | The read and write permissions |
For more information about how to create and authorize a database account, see the following topics:
- Self-managed MySQL database: Create an account for a user-created MySQL database and configure binary logging
- ApsaraDB RDS for MySQL instance: Create an account on an ApsaraDB RDS for MySQL instance and Modify the permissions of a standard account on an ApsaraDB RDS for MySQL instance