Connect to Google Cloud SQL for MySQL
Cloud SQL is a fully-managed database service that makes it easy to set-up, maintain, manage and administer your relational MySQL databases on Cloud Platform. The Cloud SQL connector allows you to access data from Cloud SQL databases within Data Studio.In this article:
How to connect to Cloud SQL
A Data Studio data source can connect to a single Cloud SQL database table.
cloudsql.clientpermission in the Cloud SQL project to create the connection. If you don't have this access, you can use the MySQL connector instead.
- Sign in to Data Studio. After signing in, you'll see the Home page, with the REPORTS tool selected.
- On the left, navigate to the DATA SOURCES Home page.
- In the bottom right, click .
- Select the Cloud SQL connector.
- Select a connection option (described below) and provide your connection details.
- Configure access to your database using one of the connection options (see below).
- Click AUTHENTICATE.
- You will see a list of tables in that database.
- Select a table.
- In the upper right, click CONNECT.
- The data source fields panel appears.
- The data source is now connected to your data set.
You can now access all of the columns in the table as fields in your reports.
Connecting with a Cloud SQL instance connection name requires the following information:
- Instance Connection Name
To connect via a JDBC URL, provide the following connection information:
- JDBC URL
jdbc:google:mysql://<instance connection name>/<database>
The instance connection name identifies your instance on the Google Cloud Platform. You can get it from the Cloud Platform Console, or by using the
gcloud command-line tool:
gcloud sql instances describe [INSTANCE_NAME]
For example, for the instance
myinstance1 in project
myproject1, the gcloud output would be:
Select the CUSTOM QUERY option to provide a SQL query instead of connecting to a single table. Data Studio uses this custom SQL as an inner select statement for each generated query to the database.
Special data types
Data Studio will map your table’s column data types to a unified set of Data Studio types. Some database types are currently not supported in Data Studio. When Data Studio encounters a column of a non-supported type, it will not create a field for that column.
Unsupported database types
Data Studio does not support MySQL's Spatial Data Extensions.
Older version migrated to MySQL connector
August 2017: Data sources created using the previous version of the connector have been migrated to the MySQL connector.
The older version of the Cloud SQL connector required you to whitelist a number of IP addresses, and did not provide encrypted connections. The current version of the connector no longer requires whitelisting, and it provides encryption; however, to use these features, you must create a new data source using the Cloud SQL connector.