Migrating an Instance to Second Generation

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

Introduction

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.

Migrating

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 database flag to On.

    For help, see Configuring Database Flags.

  4. On your local workstation, export the current instance's data to a local SQL 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 SQL dump file from your workstation to the bucket.

  6. Import the SQL dump file to the target instance, following the instructions in Importing SQL dump files to a Cloud SQL instance.

  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

Send feedback about...

Cloud SQL for MySQL