Migrate data from Cloud SQL to an external server

MySQL  |  PostgreSQL  |  SQL Server

This page describes how you can move the location of your primary instanceto an external, self-managed server with a minimum of downtime.

Migrate data to an external server

To migrate the primary copy of your data from Cloud SQL to an externalserver with the least downtime, you set up your external server as anexternal replica, then demote the Cloud SQL instance to become the replicaof the external server.

This procedure requires you to complete the following high-level steps:

  1. Create an external replica for your Cloud SQL instance, followingthe steps inConfiguring External Replicas.
  2. When the replica is fully synchronized with the Cloud SQL primary,take your applications offline, and update the applications to point tothe external server.
  3. Follow the instructions provided inDemoting the primary instance of an external replica to demote theCloud SQL primary instance. Demoting the primary instance also promotesthe external server, making it the new primary instance.

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-11-24 UTC.