The MySQL connector allows you to access data from MySQL databases within Looker Studio.
In this article:How to connect to MySQL
A Looker Studio data source can connect to a single MySQL database table.
The Looker Studio MySQL connector is based on Google Cloud SQL for MySQL, and is subject to the same limits on versions and supported features. Learn more about Google Cloud SQL for MySQL.
Supported versions
We've tested Looker Studio 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 Looker Studio Help Community. You can add and vote on feature requests here.
To connect
- Sign in to Looker Studio.
- In the top left, click
then select Data Source.
- Select the MySQL connector
- Set up the connection to your database:
Connect with a hostname or IP address,
- On the left, select BASIC.
- Enter the connection details:
- Hostname or IP address
- Port (Optional)
- Database
- Username
- Password
Connect with a JDBC URL
- On the left, select JDBC URL.
- Enter the connection details:
- JDBC URL
Example
jdbc:mysql://<hostname or IP address>[:<port>]/<database>
- Username
- Password
- JDBC URL
If you use the JDBC hostname option, you can make sure it's accessible with public DNS lookup tools such as Whois.Note: Looker Studio can't connect tolocalhost
. You must use a public hostname or IP address. -
Enable SSL (optional)
Looker Studio supports secure (encrypted) connections to the server using the TLS (Transport Layer Security) protocol. TLS is also referred to as SSL (Secure Sockets Layer). To enable a secure connection, check Enable SSL, then provide your SSL configuration files.
-
Enable client authentication (optional)
When this box is checked, you can upload a client private key and a client certificate if required to access your database.
- Click AUTHENTICATE.
- 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. Looker Studio uses this custom SQL as an inner select statement for each generated query to the database.
Custom SQL queries may only have a single statement.
For example, the following will not work because it has multiple SQL statements:
DECLARE cost_per_tb_in_dollar FLOAT64 DEFAULT 4.2;
SELECT total_bytes_billed / (1024 * 1024))* cost_per_tb_in_dollar)/(1024*1024))) FROM billing-table;
This is also true when exploring from BigQuery: your query result set may only be based on a single statement.
- 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
Data types
Looker Studio maps your database's native data types to a unified set of data types. If Looker Studio encounters a column in your table or query of an unsupported type, it will not create a field for that column.
Note: Looker Studio does not support MySQL's Spatial Data Extensions.
Firewall access
To allow Looker Studio to connect to and query databases that are behind a firewall, you will need to open access to specific IP addresses.
Show the list of IP addresses
142.251.74.0/23 2001:4860:4807::/48 (Optional, for platforms that support IPv6) 74.125.0.0/16
Limits of the MySQL connector
- You can query a maximum of 150K rows per query using this connector.
- Column headers (field names) must use ASCII characters only. Non-ASCII characters aren't supported.