Migration of MySQL databases to cloud databases
Migration of MySQL databases to cloud databases
You can migrate data from your MySQL database to cloud databases:
- Create SQL dump.
- Restore database from SQL dump.
Only InnoDB is supported.
For your information
Before migrating, make sure that the MySQL DBMS versions match. We do not guarantee portability between different versions. See official documentation for details.
Create SQL dump
Create a 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>
is the name of the database user in the source;<password>
— database user password;<host>
— DNS or IP address of the node;<port>
— port to connect to the database;--set-gtid-purged=off
— The key indicates that replication based on global GTIDs is not used;--no-tablespaces
— cancel the addition of 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
— create SQL dump as a single transaction;<database_name>
is the name of the database.
Restore database from SQL dump
Restore the database from SQL dump using the mysql utility:
mysql --user=<user_name> \
--password=<password> \
--host=<host> \
--port=3306 <database_name> < dump.sql
Specify:
<user_name>
is the username of the cloud database;<password>
— database user password;<host>
— DNS or IP address of the node;<database_name>
is the name of the database.
If you are connecting with an SSL certificate, set 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>
is the username of the cloud database;<password>
— database user password;<host>
— DNS or IP address of the node;<database_name>
is the name of the database.