This page describes how to move your data to an instance running a later version of MySQL.
Before you begin
Before moving your data to an instance running a newer version of MySQL, familiarize yourself with the differences between the MySQL versions:
- Changes affecting upgrades to MySQL 5.6
- Changes affecting upgrades to MySQL 5.7
- Changes affecting upgrades to MySQL 8.0
There are two ways to upgrade your Cloud SQL for MySQL instance from one MySQL version to a later version. Both options involve moving your database to a new Cloud SQL instance.
- Option 1. Use the Database Migration Service (DMS). DMS supports migrating from a Cloud SQL MySQL instance. You can also use it to upgrade your MySQL version.
- Option 2. Move your data from one version of MySQL to another by exporting data from the current instance and importing that data into a new instance running the later version of MySQL. This process involves downtime; you put the current instance into read-only mode before starting the export.
The rest of this document discusses the second option.
Upgrading using export and import
To move your data to a Cloud SQL instance running a later version of MySQL:
Create the target instance, with the desired MySQL version.
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.
Confirm that you can connect to the new instance with your local MySQL tools and update them if necessary.
Put your current Cloud SQL instance into read-only mode by setting the
read_onlydatabase flag to
For help, see Configuring Database Flags.
Export the current instance's data to a SQL dump file, following the instructions in Exporting data for Import into Cloud SQL.
Do not export the
Create a Cloud Storage bucket if needed, and upload your SQL dump file to the bucket.
Import the data to the target instance, following the instructions in Importing MySQL databases from Cloud Storage.
Update your applications to connect to the new instance.
When you are confident that your new instance is operating successfully, delete the old instance.
- Learn more about Changes affecting upgrades to MySQL 5.6.
- Learn more about Changes affecting upgrades to MySQL 5.7.
- Learn more about Changes affecting upgrades to MySQL 8.0.
- Learn more about migrating to a new instance type.
- Learn more about the Database Migration Service.
- Learn about importing and exporting data.
- Learn about options for connecting to an instance.
- Learn more about setting MySQL flags.