All Products
Search
Document Center

Data Transmission Service:Migrate from self-managed MySQL to PolarDB for MySQL

Last Updated:Jul 17, 2026

You can use Data Transmission Service (DTS) to migrate data from a self-managed MySQL database to PolarDB for MySQL, a cloud-native distributed relational database that is fully compatible with MySQL.

Prerequisites

  • The self-managed MySQL database is version 5.1, 5.5, 5.6, 5.7, or 8.0.
  • You have created a destination PolarDB for MySQL cluster. For more information, see Create a custom cluster.
  • If your MySQL database is deployed on-premises, you must add the IP addresses of DTS servers to the whitelist of the database to allow remote connections. For more information, see Add the IP address of a DTS server to a whitelist.
  • Throttling for full data migration is not supported.

Usage notes

  • During a full data migration, DTS consumes read and write resources on the source and destination databases, increasing their load. If your databases have poor performance, low specifications, or high workloads (for example, if the source database has many slow SQL queries or tables without primary keys, or if deadlocks occur in the destination database), the increased load can strain your databases or even cause service interruptions. Perform the data migration during off-peak hours, such as when the CPU utilization of both databases is below 30%.

  • If the source database has no primary key, unique constraint, or column with unique values, duplicate data may appear in the destination database.
  • For FLOAT or DOUBLE columns, DTS reads values by using ROUND(COLUMN,PRECISION). If you do not specify a precision, DTS uses 38 digits for FLOAT and 308 digits for DOUBLE. Verify that these precisions meet your business requirements.
  • If a data migration task fails, DTS automatically resumes it. Before you switch your workloads to the destination cluster, end or release the task to prevent the resumed task from overwriting data in the destination cluster.

Migration types

DTS supports schema migration, full data migration, and incremental data migration. For more information, see Key concepts.

Note

By using all three migration types together, you can achieve a smooth, zero-downtime database migration.

Billing

Migration type

Task configuration fee

Internet traffic fee

Schema migration and full data migration

Free of charge.

DTS charges an Internet traffic fee when the Access Method of the destination database is set to Public IP Address. Billing overview.

Incremental data migration

Charged. Billing overview.

SQL operations for incremental migration

Operation type

SQL statement

DML

INSERT, UPDATE, DELETE, and REPLACE

DDL

  • ALTER TABLE and ALTER VIEW

  • CREATE FUNCTION, CREATE INDEX, CREATE PROCEDURE, CREATE TABLE, and CREATE VIEW

  • DROP INDEX and DROP TABLE

  • RENAME TABLE

  • TRUNCATE TABLE

Permissions required for database accounts

Database Schema/full migration Incremental migration
self-managed MySQL database SELECT REPLICATION CLIENT, REPLICATION SLAVE, SHOW VIEW, and SELECT
PolarDB for MySQL cluster Read and write permissions Read and write permissions

To create a database account and grant permissions:

Preparations

Create an account for a self-managed MySQL database and configure binary logging

Procedure

  1. Log on to the DTS console.

    Note

    If you are automatically redirected to the Data Management (DMS) console, you can click the jiqiren icon in the lower-right corner and then click 返回旧版 to return to the classic DTS console.

  2. In the left-side navigation pane, click Data Migration.

  3. At the top of the Migration Tasks page, select the region of the destination cluster.

  4. In the upper-right corner of the page, click Create Data Migration Task.

  5. Configure the connection settings for the source and destination databases.
    Category Setting Description
    N/A Task Name DTS automatically generates a task name. You can specify a descriptive name for easier identification. The name does not need to be unique.
    Source Database Instance Type Select a type based on where your source database is deployed. In this example, User-Created Database with Public IP Address is selected.
    Note

    If your self-managed database is of a different instance type, you may need to complete additional preparations. For more information, see Preparations for data migration.

    Instance Region If you select User-Created Database with Public IP Address for the instance type, the Instance Region is not required.
    Note If your self-managed MySQL database has a whitelist configured, click Get IP Address Segment of DTS after the Instance Region setting to obtain the DTS server IP addresses, and then add them to the whitelist of your self-managed MySQL database.
    Database Type Select MySQL.
    Hostname or IP Address Enter the endpoint of the self-managed MySQL database. In this example, enter the public IP address.
    Port Enter the service port of the self-managed MySQL database. The default is 3306.
    Database Account Enter the account for the self-managed MySQL database. For permission requirements, see Permissions required for database accounts.
    Database Password Enter the password for the account.
    Note After you configure the source database information, you can click Test Connectivity next to Database Password to verify the connection. If the connection is successful, a Passed message appears. If it fails, a Failed message appears. Click Diagnose next to Failed and modify the source database settings based on the results.
    Destination Database Instance Type Select PolarDB.
    Instance Region Select the region of the destination PolarDB for MySQL cluster.
    PolarDB Instance ID Select the ID of the destination PolarDB for MySQL cluster.
    Database Account Enter the account for the destination PolarDB for MySQL cluster. For permission requirements, see Permissions required for database accounts.
    Database Password Enter the password for the account.
    Note After you configure the destination database information, you can click Test Connectivity next to Database Password to verify the connection. If the connection is successful, a Passed message appears. If it fails, a Failed message appears. Click Diagnose next to Failed and modify the destination database settings based on the results.
  6. After you complete the configuration, click Set Whitelist and Next in the lower-right corner of the page.
    DTS automatically adds its server IP addresses to the whitelist of an Alibaba Cloud database instance (such as RDS for MySQL or ApsaraDB for MongoDB) or the ECS security group of a self-managed database. You must also ensure the self-managed database on the ECS instance allows access. For a database cluster on multiple ECS instances or a database in an IDC or from another cloud provider, you must manually add the DTS server IP addresses.
    Warning

    Adding the public CIDR blocks of DTS servers, whether automatically or manually, may introduce security risks. By using this product, you acknowledge and accept these potential risks. You are responsible for implementing basic security measures, including but not limited to using strong passwords, restricting open ports, using authentication for internal API calls, regularly reviewing and restricting unnecessary network segments, or connecting through private networks such as Express Connect, VPN Gateway, or Smart Access Gateway.

  7. Select the migration types and objects.

    选择迁移对象和类型

    Setting

    Description

    Migration types

    • To perform only a full migration, select both Schema Migration and Full Data Migration.

    • To perform a zero-downtime migration, select Schema Migration, Full Data Migration, and Incremental Data Migration.

    Important

    If you do not select Incremental Data Migration, do not write new data to the source database during the full data migration to ensure data consistency.

    Migration objects

    In the Available box, click the objects that you want to migrate and click the 向右小箭头 icon to move them to the Selected Objects box.

    Important
    • You can select objects to migrate at the database, table, and column levels.

    • By default, object names are retained after migration. If you need to rename an object in the destination database, use the object name mapping feature. For more information, see Object name mapping.

    • If you rename an object by using the object name mapping feature, other objects that depend on it may fail to migrate.

    Object name mapping

    If you need to rename a migrated object in the destination instance, use the object name mapping feature. For more information, see Object name mapping.

    Connection retry duration

    If a connection to the source or destination database is interrupted, DTS retries to connect for a default of 720 minutes (12 hours). You can customize this duration. If DTS successfully reconnects within the specified time, the migration task resumes. Otherwise, the task fails.

    Note

    You are charged for the DTS instance while it attempts to reconnect. To avoid unnecessary charges, set an appropriate retry duration or release the DTS instance promptly if the source and destination databases are released.

    Replicate temporary tables created during online DDL operations in DMS

    If you use Data Management (DMS) to perform online DDL operations on the source database, you can choose whether to migrate the temporary tables that are generated.

    • Yes: Migrates the data in the temporary tables that are generated by online DDL operations.

      Note

      If a large amount of temporary table data is generated by online DDL operations, the migration task may experience high latency.

    • No: Does not migrate the data in the temporary tables. Only the original DDL data from the source database is migrated.

      Note

      This option may cause table locks on the destination database.

  8. After you complete the configuration, click Precheck and Start in the lower-right corner of the page.

    Note
    • Before the migration task starts, DTS runs a precheck. The task can start only after it passes the precheck.

    • If the precheck fails, click the 提示 icon next to the failed item to view details.

      • Fix the issues as prompted and run the precheck again.

      • If you do not need to fix the warning items, you can select Ignore and then click Ignore Warnings and Rerun Precheck to run the precheck again.

  9. After the task passes the precheck, click Next.

  10. In the Confirm Settings dialog box that appears, select a Instance Class and select the Data Transmission Service (pay-as-you-go) Service Terms checkbox.

  11. Click Buy and Start to begin the migration.

    • Schema migration + Full data migration

      Allow the task to complete automatically. Stopping it manually may result in incomplete data.

    • Schema migration + Full data migration + Incremental data migration

      The migration task does not stop automatically. You must stop it manually.

      Important

      Choose an appropriate time to stop the task manually, such as during off-peak hours or when you are ready to switch your business to the destination cluster.

      1. Wait until the migration task enters the Incremental Data Migration phase and the status shows Undelayed. Then, stop writing data to the source database for several minutes. During this time, the status of Incremental Data Migration may show a latency.

      2. Wait for the Incremental Data Migration status to show Undelayed again. Then, manually stop the migration task.结束增量迁移任务

  12. Switch your business to the PolarDB for MySQL cluster.