GCP CloudSQL Migration Guide
Overview
This document will demonstrate how to migrate a database from Google Cloud Platform (GCP) CloudSQL MySQL Cluster to PlanetScale using our Import tool.
Note
This guide assumes you are using MySQL on GCP. Other database systems available through GCP will not work with the PlanetScale import tool.
We recommend reading through the Database import documentation to learn how our import tool works before proceeding.
Prerequisites
You’ll also need to gather the following pieces of information from the GCP Console:
- Public IP address
- Database name
- Root username and password
The public IP address can be found in the Overview tab of your CloudSQL cluster under the Connect to this instance section.
A list of your databases can be found in the Databases tab. In this guide, we’ll be using the tasksdb
database.
The root
username is the account set up by default for all CloudSQL instances. The password for that account was set during the creation of the instance.
Note
If you don’t know the admin password, you can create a new set of credentials using the information on the Import tool user permissions page to create an account that can be used to import your database.
Allow PlanetScale to connect to your CloudSQL instance
For PlanetScale to connect to your database, you’ll need to update the Authorized networks for your cluster. The specific IP addresses to permit depend on the region selected for your new database, which is in the New database section of the import tool in the Region field.
You will need to allow traffic for each IP address listed under that region on the Import tool public IP addresses page. You can also find these listed in the “Import external database” page. To permit traffic from these IP addresses to your database in GCP, select Connections from the navigation on the left. Under Authorized networks, click “Add network”. This will display an inline form for you to add a network. The name of the field is arbitrary, but the Network field should contain the IP address that needs access to your database. Click “Done” to add the new entry. Perform this step for each IP address for the selected region, then click “Save” to apply the settings.
Configure MySQL server settings
There is one flag that needs to be configured before you can import your database:
- binlog_expire_logs_seconds
To set a flag in your GCP console, go to your database's “Overview” page, select the “Edit” button, and then scroll down to the “Flags” section.
You want to select the “binlog_expire_logs_seconds” flag and set it to 172800
seconds.
Make sure to select the “Done” button.
Importing your database
In the PlanetScale dashboard, click “New database”, then “Import database”.
Complete the form using the information gathered in the previous section. Click "Connect to database” and the import tool will attempt to connect to your GCP CloudSQL instance.
The “Connect to database