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 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 hosted in an ApsaraDB RDS for MySQL instance. You can follow the procedure to configure data migration tasks for other types of MySQL databases.Source database | Destination database |
---|---|
|
|
Prerequisites
- The engine version of the self-managed MySQL database is 5.1, 5.5, 5.6, 5.7, or 8.0.
- The CIDR blocks of DTS servers are added to the IP address whitelist of the source MySQL database if the database is an on-premises 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 |
|
Billing
Migration type | Instance configuration fee | Internet traffic fee |
---|---|---|
Schema migration and full data migration | Free of charge. | Charged only when data is migrated from Alibaba Cloud over the Internet. For more information, see Billing overview. |
Incremental data migration | Charged. For more information, see Billing overview. |
Migration types
- Schema migration
Data Transmission Service (DTS) migrates the schemas of 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 required objects from the source database to the destination database.
- Incremental data migration
After full data migration is complete, 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 incrementally migrated
Operation type | SQL statement |
---|---|
DML | INSERT, UPDATE, and DELETE |
DDL |
|
Permissions required for database accounts
Database | Schema migration | Full data migration | Incremental data migration |
---|---|---|---|
Self-managed MySQL database | SELECT permission | SELECT permission | SELECT permission on the objects to be migrated
REPLICATION CLIENT, REPLICATION SLAVE, and SHOW VIEW permissions 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 | Read and write permissions |
For more information about how to create and grant permissions to 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