Skip to content

GCP CloudSQL Migration Guide

Learn how to migrate your database from Google Cloud Platform (GCP) CloudSQL MySQL Cluster into PlanetScale using our Import tool.

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.

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.

The GCP CloudSQL console with the IP address highlighted.The GCP CloudSQL console with the IP address highlighted.

A list of your databases can be found in the Databases tab. In this guide, we’ll be using the tasksdb database.

The Databases list in the GCP console.The Databases list in the GCP console.

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.

The New database section of the Import database tool.The New database section of the Import database tool.

You will need to allow traffic for each IP address listed under that region on the Import tool public IP addresses 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.

The form to add a new authorized network in the GCP console.The form to add a new authorized network in the GCP console.

Importing your database

In the PlanetScale dashboard, click “New database”, then “Import database”.

The default view of all databases in the PlanetScale organization.The default view of all databases in the PlanetScale organization.

At the time of this writing, the Import database feature is in beta. If this is your first time accessing this feature, you will be prompted to opt into using the feature. Click “Join beta” to proceed.

The Join beta view.The Join beta view.

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 Import database form.The Import database form.

If the connection was successful, you’ll see the following message. Click “Begin database import” to start importing data.

The note that is displayed when the PlanetScale import tool can connect to the external database.The note that is displayed when the PlanetScale import tool can connect to the external database.

The following view will show you the progress of your data being imported.

The Database import view during the initial import process.The Database import view during the initial import process.

Once your database has finished importing, the view will update to show the database that was created in PlanetScale, as well as the option to enable primary mode. This button will make the PlanetScale version of the database the primary replica. Clicking “Enable primary mode” will display a modal where you can confirm that you want to make this change.

The Database import view once the initial import has been completed.The Database import view once the initial import has been completed.

After primary mode is enabled, the third card in the flow will update to give you two options. Enable replica mode will revert the change performed in the previous step, whereas Finish import will detach the databases from replication and future changes to either the PlanetScale database or the CloudSQL database will not be replicated to each other. Click “Finish import” to complete the import process. Confirm in the modal that will be displayed.

The Database import view after the PlanetScale database has been flagged as the primary database.The Database import view after the PlanetScale database has been flagged as the primary database.

This concludes the process used to import a database into PlanetScale from GCP CloudSQL.

Need help?

Get help from the PlanetScale support team, or join our GitHub discussion board to see how others are using PlanetScale.

Was this page useful?
Last updated on August 1, 2022
Help us improve this page
PrivacyTerms© 2022 PlanetScale Inc.