About data migration in Cloud SQL

MySQL  |  PostgreSQL  |  SQL Server

This page describes data migration options in Cloud SQL.

Database Migration Service

To migrate data from an external server into Cloud SQL, you can useDatabase Migration Service.

When you use Database Migration Service, you can create the destinationCloud SQL instance when you create a migration job.Database Migration Service uses migration jobs to migrate data from your source databaseinstance to the destination Cloud SQL instance.For more information, seeCreate a migration job to a new destination instance.

However, you might want to create your destination Cloud SQL instanceoutside of Database Migration Service. For example, you can use Terraform orother Infrastructure-As-Code (IaC) tools. In that case, after creating theCloud SQL instance, you can still use Database Migration Service to migratedata to it.For more information, seeCreate a migration job to an existing destination instance.

Replicate from an external server

Another option for migrating data from an external serverinto Cloud SQL is to use replication.Cloud SQL supports various replication modesto migrate data into your instance.

For more information, seeAbout replicating from an external server.

To set up Cloud SQL for data migration by using replication, seeConfigure Cloud SQL and the external server for replication.

Cloud SQL for MySQL also supports the migration ofexternal MySQL databases from Percona XtraBackup physical files.By using physical files to set up replication insteadof logical dump files, you can migrate your external MySQLdatabases into Cloud SQL for MySQL instances up to 3 times fasterthan using logical dump files in a parallel migration and up to 10 times faster than using logical dump files in a single-threaded migration.

For more information, seeMigrate to Cloud SQL from an XtraBackup physical file.

Limitations

  • Migrating data to a Cloud SQL instance that either hasPrivate Service Connect enabled or already contains data isn't supported. Migrating data to an instance that has aread replica requires that theGTID_MODE on the source instance is set toON.
  • If your instance has customized backup settings (for example, acustom backup location), then after you promote the instance, we recommend that you customize your backup settings again. During the promotion process, Cloud SQL resets your backup settings to their default values.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-18 UTC.