Migrating an Instance to Second Generation

This page describes how to move your data from a First Generation instance to an Second Generation instance.


The steps for moving your data from a First Generation instance to a Second Generation instance involve exporting data from the current instance and importing that data into a new Second Generation instance. This process involves downtime; you put the current instance into read-only mode before starting the export.

Before you begin

Before moving your data to Second Generation, you should familiarize yourself with the differences between First Generation and Second Generation and the connection options for Second Generation instances.


To move your data to Second Generation:

  1. Create a Second Generation instance.

    Make sure the target instance has:

    • Sufficient storage to hold all of the current instance's data.
    • The same authorized networks as the current instance. Learn more.
    • The same user accounts, with the same MySQL privileges and passwords.

    For help with creating an instance, see Creating an instance.

  2. Confirm that you can connect to the new instance with your local MySQL client and a copy of your application.

  3. Put your current Cloud SQL instance into read-only mode by setting the read_only MySQL flag to On.

    For help, see Configuring MySQL Flags.

  4. Export the current instance's data to a MySQL dump file, following the instructions in Exporting data for Import into Cloud SQL.

    You must use mysqldump to perform the export. You cannot use the export provided by Google Cloud Platform Console.

  5. Create a Cloud Storage bucket if needed, and upload your MySQL dump file to the bucket.

  6. Import the data to the target instance, following the instructions in Importing MySQL databases from Cloud Storage.

    You must change the permissions on the Cloud Storage bucket and file.

  7. Update your applications to connect to the new instance.

  8. When you are confident that your new instance is operating successfully, delete the old instance.

What's next

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud SQL for MySQL