[RDS MySQL] Manual Database Migration Tutorial

Published: 2021-07-22

If the data is relatively small, you can use the built-in import function of the RDS product to import it. Or refer to: View export tutorial>>  (Suitable for a small amount of data)


If the data is medium-sized, you can use a tool-based approach.

The specific steps are as follows:

Step 1: Download and install MySQL management software Navicat Premium . If the network connection is slow, you can also provision a server in the same cluster to set up an intranet, and install Navicat on the Elastic Cloud Server.

Step 2: Open the tool and configure connections to both the old and new databases. (If you are on an Elastic Cloud Server in the same cluster, you can use the private IP to connect to the RDS database.)

Step 3: Open the "Tools" menu in Navicat and select the "Data Transfer" function. Source: select the old database connection. Target: select the RDS database. Then execute, and the tool will migrate the data.


If the data is extremely large, such as a database size above 100T, the above conventional methods will be very slow, and during migration there is a high probability of lockups, freezes, etc., causing migration failure.

For migration of such extremely large data, it is recommended to use xtrabackup to back up the data;  

If you previously used RDS from another vendor, you can obtain the backup files and provide us with a download list of the backup files,

then submit a ticket to apply for manual assistance, charged 200 yuan/time. Our engineers will manually import the data.



Specific process for manual import of RDS large data backups:

This tutorial applies to cases where mysqldump takes too long or fails frequently.


1. Backup data preparation (User)

We support database source file packaging and restoration of innobackup backup files  , please note that your source database version must match the RDS database version


1.1. Import by packaging the MySQL data directory

To ensure data integrity, please stop the database service before packaging.


1.2. Import by backing up data with innobackup

After installing XtraBackup, export the database backup.

Command example:

innobackupex --defaults-file=/etc/my.cnf -ubakuser -p'password'  --stream=xbstream  --parallel=8  --compress --compress-threads=8 /tmp 2>>$logdir/backup$time.log > $backupdir/backup_full`date +%Y-%m-%d`.qp

Note: For 5.6/5.7, use innobackupex; for 8.0, use innobackup


2. Apply for an RDS upload account (User)

Please submit a ticket to apply for an RDS large data upload account.


3. Data upload (User)

After logging in to the upload account, you can directly download via wget or upload to the /bkup/${RDSID} directory using an sftp tool


4. Data recovery processing (User)

Please submit another ticket to notify our company to perform data recovery and synchronization processing.