All Products
Search
Document Center

ApsaraDB RDS:Migrate data from a self-managed MySQL database connected over Express Connect, VPN Gateway, or Smart Access Gateway to an ApsaraDB RDS for MySQL instance

Last Updated:Mar 28, 2026

Use Data Transmission Service (DTS) to migrate a self-managed MySQL database to ApsaraDB RDS for MySQL over a private network connection (Express Connect, VPN Gateway, or Smart Access Gateway). DTS supports schema migration, full data migration, and incremental data migration. Combining all three migration types keeps your application running during the migration and minimizes downtime during the final cutover.

Choose a migration approach

GoalMigration types to selectNotes
One-time migration with a maintenance windowSchema migration + full data migrationStop writes to the source before starting. Wait for the task to complete automatically — do not stop it manually.
Continuous replication with near-zero downtime cutoverSchema migration + full data migration + incremental data migrationKeeps source and destination in sync until you are ready to switch. Requires binary logging on the source.

Prerequisites

Before you begin, make sure you have:

  • A self-managed MySQL database running MySQL 5.1, 5.5, 5.6, 5.7, or 8.0

  • An on-premises network connected to Alibaba Cloud over Express Connect, VPN Gateway, or Smart Access Gateway

  • An ApsaraDB RDS for MySQL or RDS MySQL Serverless instance with enough free storage to hold all source data

  • A database account for the self-managed MySQL database with the required permissions (see Permissions required)

  • A database account for the RDS instance with read and write permissions

  • Binary logging enabled on the self-managed MySQL database, if you plan to use incremental data migration

For setup instructions, see:

Permissions required

DatabaseSchema migrationFull data migrationIncremental data migration
Self-managed MySQLSELECTSELECTREPLICATION SLAVE, REPLICATION CLIENT, SHOW VIEW, SELECT
ApsaraDB RDS for MySQLRead and writeRead and writeRead and write
During schema migration, DTS changes the SECURITY attribute of views, stored procedures, and functions from DEFINER to INVOKER. DTS does not migrate user accounts. To call a view, stored procedure, or function on the destination, grant the required permissions to INVOKER manually.

For instructions on creating accounts and granting permissions, see:

Billing

Migration typeTask configuration feeInternet traffic fee
Schema migration + full data migrationFreeCharged only when data is migrated from Alibaba Cloud over the Internet. See Billing overview.
Incremental data migrationCharged. See Billing overview.

Limitations

  • Table structure: Tables must have PRIMARY KEY or UNIQUE constraints, and all fields must be unique. Otherwise, the destination may contain duplicate records.

  • FLOAT/DOUBLE precision: DTS uses the ROUND(COLUMN,PRECISION) function. If no precision is specified, DTS defaults to 38 digits for FLOAT and 308 digits for DOUBLE. Verify that these defaults meet your requirements before migrating.

  • Destination database creation: DTS automatically creates the destination database. If the source database name does not comply with RDS naming rules, create the database manually before configuring the migration task.

  • Tablespace size after full migration: Concurrent INSERT operations during full data migration cause table fragmentation, so the destination tablespace will be larger than the source. Run OPTIMIZE TABLE after migration if needed.

  • Task resumption: If a migration task fails, DTS automatically resumes it. Stop or release the task before switching workloads to the destination. Otherwise, the resumed task will overwrite data in the destination.

  • Performance impact: Full data migration consumes read and write resources on both the source and destination. Run migrations during off-peak hours when CPU utilization on both databases is below 30%.

SQL operations supported during incremental data migration

Operation typeSQL statements
DMLINSERT, UPDATE, DELETE, REPLACE
DDLALTER TABLE, ALTER VIEW, CREATE FUNCTION, CREATE INDEX, CREATE PROCEDURE, CREATE TABLE, CREATE VIEW, DROP INDEX, DROP TABLE, RENAME TABLE, TRUNCATE TABLE

Create a migration task

  1. Log on to the DTS console.

    If you are redirected to the Data Management (DMS) console, click the old icon in the image to go back to the DTS console.
  2. In the left-side navigation pane, click Data Migration.

  3. At the top of the Migration Tasks page, select the region where the destination RDS instance resides.

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

  5. Configure the source and destination databases.

    SectionParameterDescription
    N/ATask nameDTS generates a name automatically. Specify a descriptive name to make the task easier to identify. Task names do not need to be unique.
    Source databaseInstance typeSelect User-Created Database Connected over Express Connect, VPN Gateway, or Smart Access Gateway.
    Instance regionSelect the region of the virtual private cloud (VPC) connected to Express Connect, VPN Gateway, or Smart Access Gateway.
    Peer VPCSelect the VPC connected to Express Connect, VPN Gateway, or Smart Access Gateway.
    Database typeSelect MySQL.
    IP addressEnter the endpoint used to access the self-managed MySQL database.
    Port numberEnter the service port. The default is 3306.
    Database accountEnter the account for the self-managed MySQL database.
    Database passwordEnter the account password. After entering the password, click Test Connectivity to verify the connection. If the test passes, Passed appears. If it fails, click Check to view and fix the issue.
    Destination databaseInstance typeSelect RDS Instance.
    Instance regionSelect the region where the RDS instance resides.
    RDS instance IDSelect the ID of the RDS instance.
    Database accountEnter the account for the RDS instance.
    Database passwordEnter the account password. After entering the password, click Test Connectivity to verify the connection.
    EncryptionSelect Non-encrypted or SSL-encrypted. To use SSL encryption, enable SSL on the RDS instance before configuring the task.

    Configure Source and Destination Databases

  6. In the lower-right corner, click Set Whitelist and Next.

    Warning

    Adding DTS server CIDR blocks to your database whitelist or ECS security group rules creates security risks. Before proceeding, take preventive measures: use strong passwords, limit exposed ports, authenticate API calls, and regularly audit whitelist rules. Alternatively, connect the database to DTS over Express Connect, VPN Gateway, or Smart Access Gateway.

  7. Select migration types and objects.

    SettingDescription
    Select migration typesFor one-time migration, select Schema Migration and Full Data Migration. For near-zero downtime migration, also select Incremental Data Migration. If Incremental Data Migration is not selected, stop all writes to the source during full data migration to maintain data consistency.
    Select objectsIn the Available section, select the columns, tables, or databases to migrate, then click Rightwards arrow to move them to the Selected section. By default, object names in the destination match the source. To rename objects, use the object name mapping feature. Renaming an object may cause dependent objects to fail migration.
    Retry time rangeIf DTS loses connection to the source or destination, it retries for up to 720 minutes (12 hours) by default. Adjust this based on your requirements. If DTS reconnects within the retry window, the task resumes automatically. DTS charges for the instance during the retry period.
    Copy temporary tables (DMS online DDL)If you use Data Management (DMS) to run online DDL operations on the source, select Yes to also migrate temporary tables generated by online DDL (this may extend migration time significantly), or select No to migrate only the original DDL data (tables in the destination may be locked).

    Select the required migration types and the objects that you want to migrate

  8. In the lower-right corner, click Precheck.

    DTS runs a precheck before starting the migration. The task can only start after passing the precheck. If any item fails, click the Info icon icon next to it to view details. Fix the issues and run the precheck again, or ignore failed items and run the precheck again if they are not blocking.
  9. After the task passes the precheck, click Next.

  10. In the Confirm Settings dialog box, specify the Channel Specification and select Data Transmission Service (Pay-As-You-Go) Service Terms.

  11. Click Buy and Start.

Stop the migration task and switch workloads

Schema migration + full data migration only

Wait for the task to complete automatically. Do not stop the task manually — doing so may leave the destination data incomplete.

Schema migration + full data migration + incremental data migration

Incremental migration does not stop automatically. Follow these steps to cut over safely:

  1. Wait until the progress bar shows Incremental Data Migration and The migration task is not delayed.

  2. Stop all writes to the source database and wait a few minutes.

  3. Wait until the progress bar shows The migration task is not delayed again, confirming that all remaining changes have been applied.

  4. Manually stop the migration task.

    Stop an incremental data migration task

  5. Update your application connection strings to point to the destination RDS instance.

Stop the task during off-peak hours or just before switching workloads to minimize risk.

Post-migration checklist

After switching workloads to the destination RDS instance, complete the following:

  • Verify application connectivity: Confirm that your application can connect to the RDS instance and that queries return expected results.

  • Recreate user accounts and permissions: DTS does not migrate user accounts. Recreate the necessary accounts and grant the required permissions on the destination database.

  • Check views, stored procedures, and functions: DTS changes the SECURITY attribute from DEFINER to INVOKER. Grant INVOKER the necessary permissions to call these objects.

  • Optimize tables (if needed): Full data migration may cause table fragmentation. Run OPTIMIZE TABLE on affected tables to reclaim space.

  • Release the DTS task: After confirming the migration is complete, stop and release the DTS instance to avoid unnecessary charges.

What's next