Skip to main content

Migration of MySQL databases to MySQL semi-sync Managed Databases

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

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

Only InnoDB is supported.

For your information

Before migration, make sure that the MySQL DBMS versions match. We do not guarantee migration between different versions. For more information, see the official documentation.

1. 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> — database user name on the source;
  • <password> — database user password;
  • <host> — DNS or IP address of the node;
  • <port> — port for connecting to the database;
  • --set-gtid-purged=off — flag indicates that replication based on global transaction identifiers (GTIDs) is not used;
  • --no-tablespaces — disables adding service information to the dump that requires additional privileges to access. This information does not affect user data and can be excluded from the dump;
  • --single-transaction — creates an SQL dump as a single transaction;
  • <database_name> — database name.

2. Restore the database from the SQL dump

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

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

Specify:

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

If you connect using an SSL certificate, specify the additional parameters --ssl-ca and --ssl-mode:

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

Specify:

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