This topic describes how to migrate data from a self-managed MySQL database to Migrate data from a self-managed MySQL database to an ApsaraDB MyBase 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.
In this topic, operations are performed in the new version of the DTS console. For information about how to migrate data from a self-managed MySQL database to an ApsaraDB MyBase for MySQL instance in the old version of the DTS console, see Migrate data from a self-managed MySQL database to an ApsaraDB MyBase for MySQL instance.
Prerequisites
- The version of the self-managed MySQL database is 5.1, 5.5, 5.6, 5.7, or 8.0.
- An ApsaraDB MyBase for MySQL instance is created. For more information, see Create an ApsaraDB MyBase for MySQL instance.
- The available storage space of the instance is larger than the total size of the data in the self-managed MySQL database.
- 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 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.
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 hosted on an Elastic Compute Service (ECS) instance and the destination database is an ApsaraDB MyBase for MySQL instance. You can also follow the procedure to configure data migration tasks for other types of MySQL databases.Source database | Destination database |
---|---|
|
|
Limits
Category | Description |
---|---|
Limits on the source database |
|
Other limits |
|
Special cases |
|
Billing
Migration type | Task 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 Pricing. |
Incremental data migration | Charged. For more information, see Pricing. |
Migration types
- Schema migration
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 completed, DTS migrates incremental data from the source database to the destination database. Incremental data migration ensures service continuity when you migrate data between self-managed databases.
SQL operations that can be performed for incremental data migration
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 that is hosted on an ECS instance | The SELECT permission | The SELECT permission | Incremental data migration: the SELECT permission on the objects to be migrated
The REPLICATION CLIENT, REPLICATION SLAVE, and SHOW VIEW permissions |
ApsaraDB MyBase for MySQL instance | The read and write permissions |
For information about how to create a database account and grant permissions to the account, see the following topics:
- For a self-managed MySQL database, see Create an account for a user-created MySQL database and configure binary logging.
- For an ApsaraDB MyBase for MySQL instance, see Create a database account and Manage a database account.
Procedure
What to do next
The database accounts that are used for data migration have the read and write permissions. After you migrate data, you must delete the database accounts to ensure database security.