This topic describes how to use the mysqldump client to migrate data to an RDS for MariaDB TX instance.

Background information

RDS is fully compatible with native database services. The process of migrating data from native databases to RDS instances is similar to that of migrating data from a MariaDB server to another.

This topic takes an on-premises server running Linux 7 and MariaDB 10.2.4 as an example to describe how to migrate data from an on-premises database to an RDS for MariaDB TX instance.

Precautions

The name of the table after migration is case-insensitive and displayed in lowercase letters.

Prerequisites

The RDS instance has a whitelist and a public endpoint. For more information, see Configure a whitelist for an RDS for MariaDB instance and Apply for a public endpoint for an RDS for MariaDB instance.

Procedure

  1. Use a remote access tool to log on to the RDS for MariaDB TX instance and create a database.
  2. Log on to the on-premises Linux server and use the mysqldump tool to export the on-premises database data as a data file.
    mysqldump -h localhost -u root -p<root account password> --opt --default-character-set=utf8 --hex-blob <Name of the database to be migrated> --skip-triggers > /tmp/<Name of the database to be migrated>.sql
    Note Do not update data during the export process. This step only exports data. It does not export stored procedures, triggers, or functions.
  3. Use mysqldump to export stored procedures, triggers, and functions.
    mysqldump -h localhost -u root -p<root account password> --opt --default-character-set=utf8 --hex-blob <Name of the database to be migrated> -R | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' > /tmp/<Name of the database to be migrated>trigger.sql
    Note Skip this step if no stored procedures, triggers, or functions are used in the database. When exporting stored procedures, triggers, and functions, you must remove the DEFINER clause to guarantee compatibility with RDS.
  4. Run the following statements to import data files and stored procedure files to the destination RDS instance:
    mysql -h <Public IP address of the RDS instance> –u <Privileged account of the RDS instance> -p<Privileged account password of the RDS instance> < /tmp/<Name of the database to be migrated>.sql
    mysql -h <Public IP address of the RDS instance> -u <Privileged account of the RDS instance> -p<Privileged account password of the RDS instance> < /tmp/<Name of the database to be migrated>trigger.sql
  5. Refresh the data query page of the remote access tool and view the table. If data exists in the table, the migration is successful.