Connect to Google Cloud SQL for MySQL

Connect Data Studio to Google Cloud SQL databases.

Cloud SQL for MySQL 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 for MySQL connector allows you to access data from Cloud SQL for MySQL databases within Data Studio.

In this article:

Supported versions

The Cloud SQL for MySQL connector was tested on the following MySQL versions:

  • 5.6
  • 5.7
  • 8.0

If you experience issues using a supported version, please let us know in the Data Studio Help Community. You can add and vote on feature requests here.

How to connect to Cloud SQL for MySQL

A Data Studio data source can connect to a single Cloud SQL for MySQL database table, or to a custom query you provide.

To connect

  1. Sign in to Data Studio.
  2. In the top left, click Create then select Data Source.
  3. Select the Cloud SQL for MySQL connector.
  4. If asked, authorize Data Studio to access your data.
  5. Set up the connection to your database:

    Connect with a hostname or IP address

    1. On the left, select BASIC.
    2. Enter the connection details:
      1. Instance Connection Name (see below to find out how to list your instance connections).
      2. Database
      3. Username
      4. Password

    Connect with a JDBC URL

    1. On the left, select JDBC URL.
    2. Enter the connection details:
      1. JDBC URL

        Example

        jdbc:google:mysql://<instance connection name>/<database>

      2. Username
      3. Password
    If you use the JDBC hostname option, you can make sure it's accessible with public DNS lookup tools such as Whois.
    Note: Data Studio can't connect to localhost. You must use a public hostname or IP address.
  6. Click AUTHENTICATE.
  7. Select a table from the list or enter a custom query.
    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.
  8. Click CONNECT.

In a moment, the data source fields list page appears. In the upper right, click CREATE REPORT or EXPLORE to start visualizing your data.

Notes

Find your instance connection name

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 command line.

Use the console

  1. Navigate to https://console.cloud.google.com/sql/instances
  2. Click the Instance ID you want to connect to.
  3. On the left, you'll find connection Name in the "Connect to this instance" section.

Use the command line

To find the connection name using the Cloud command line interface, use the following command:

gcloud sql instances describe [INSTANCE_NAME] | grep connectionName

Permissions

You must have at least cloudsql.client permission in the Cloud SQL for MySQL project to create the connection. If you don't have (or can't get) this access, you can use the MySQL connector instead.

Public IP

Data Studio only supports Cloud SQL for MySQL instances with public IP connectivity. Please configure public IP connectivity for your Cloud SQL for MySQL instance.

Data types

Data Studio maps your database's native data types to a unified set of data types. If Data Studio encounters a column in your table or query of an unsupported type, it will not create a field for that column.

Note: Data Studio does not support MySQL's Spatial Data Extensions.

Limits of the Cloud SQL for MySQL connector

  • You can query a maximum of 150K rows using this connector.
  • Column headers (field names) must use ASCII characters only. Non-ASCII characters aren't supported.
Was this helpful?
How can we improve it?
true
What's new in Data Studio

Learn about new features and recent changes.

Search
Clear search
Close search
Google apps
Main menu
Search Help Center
true
102097
false