Skip to main content

Migration of MySQL databases to MySQL sync Managed Databases

You can migrate data from your MySQL database to Managed Databases:

  1. Create an SQL dump.
  2. Restore the database from an SQL dump.

Only InnoDB is supported.

For your information

Before migrating, ensure that the MySQL DBMS versions match. We do not guarantee migration between different versions. Learn more in the official documentation.

Create an SQL dump

Create an SQL dump of the database using the mysqldump utility:

mysqldump --user=<user_name> \
--password=<password> \
--host=<host> \
--port=<port> \
--set-gtid-purged=off \
--no-tablespaces \
--single-transaction <database_name> > dump.sql

Specify:

  • <user_name> — the source database user name;
  • <password> — the database user password;
  • <host> — the DNS or IP address of the node;
  • <port> — the port for connecting to the database;
  • --set-gtid-purged=off — the option indicates that GTID-based replication is not used;
  • --no-tablespaces — prevents adding service information to the dump that requires additional permissions to access. This information does not affect user data and can be excluded from the dump;
  • --single-transaction — creates an SQL dump within a single transaction; ;
  • <database_name> — the name of the database.

Restore a database from an SQL dump

Restore the database from an SQL dump using the mysql utility:

mysql --user=<user_name> \
--password=<password> \
--host=<host> \
--port=6033 <database_name> < dump.sql

Specify:

  • <user_name> — the user name of the Managed Database;
  • <password> — the database user password;
  • <host> — the DNS or IP address of the node;
  • <database_name> — the name of the database.

If you are connecting with an SSL certificate, specify the additional --ssl-ca and --ssl-mode: parameters:

mysql --user=<user_name> \
--password=<password> \
--host=<host> \
--port=6033 \
--ssl-ca=~/.mysql/root.crt \
--ssl-mode=required <database_name> < dump.sql

Specify:

  • <user_name> — the user name of the Managed Database;
  • <password> — the database user password;
  • <host> — the DNS or IP address of the node;
  • <database_name> — the name of the database.