Migration of MySQL databases to MySQL semi-sync Managed Databases
You can migrate data from your MySQL database to Managed Databases:
- Create an SQL dump.
- Restore the database from the SQL dump.
Only InnoDB is supported.
For your information
Before migrating, make sure that the MySQL DBMS versions match. We do not guarantee migration between different versions. For more information, see the official documentation.
Create an SQL dump
Create an SQL database dump 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>— source database username;<password>— database user password;<host>— node DNS or IP address;<port>— port for connecting to the database;--set-gtid-purged=off— option indicates that GTID-based replication 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 in a single transaction;<database_name>— database name.
Restore the 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=3306 <database_name> < dump.sql
Specify:
<user_name>— cloud database username;<password>— database user password;<host>— node DNS or IP address;<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 username;<password>— database user password;<host>— node DNS or IP address;<database_name>— database name.