MySQL Database Migration

You can transfer data to a MySQL cluster using the mysqldump and mysql utilities.

The service only supports InnoDB. Before migration, make sure that the database engine versions are the same, as the transfer between different database engine versions is not guaranteed. Learn more in the official documentation.

Creating sql dump

To create a sql dump, run the following:

mysqldump --user=<username> --password --host=<source_host> --port=<port> --set-gtid-purged=off --single-transaction <database> > dump.sql

Restoring from dump

Use the mysql utility to restore from dump:

mysql --user=<username> --password --host=<target_host> --port=6033 <database> < dump.sql

When using SSL, additionally set the --ssl-ca parameters to specify the certificate, and --ssl-mode to specify the connection mode.

mysql --user=<username> --password --host=<target_host> --port=6033 --ssl-ca=~/.mysql/root.crt --ssl-mode=required <database> < dump.sql