## Encrypting network traffic

It is a best practice to encrypt network traffic between the Looker application and your database. Consider one of the options that are described on the [Enabling secure database access](https://docs.cloud.google.com/looker/docs/2622/enabling-secure-db-access.md.txt) documentation page.

## Connect using Application Default Credentials (ADC)

For [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/looker-core-overview.md.txt) instances, [Application Default Credentials (ADC)](https://docs.cloud.google.com/docs/authentication/application-default-credentials.md.txt) is supported as a method of authentication for Google Cloud SQL for MySQL.

When you set up ADC for Google Cloud SQL for MySQL, you must do the following procedures:

- [Add the impersonated service account to your Cloud SQL database](https://docs.cloud.google.com/looker/docs/looker-core-dialects.md.txt#add-the-impersonated-service-account)
- [Set up service account impersonation on your Cloud SQL database](https://docs.cloud.google.com/looker/docs/looker-core-dialects.md.txt#set-up-service-account-impersonation)
- [Run additional configuration commands for Cloud SQL for MySQL](https://docs.cloud.google.com/looker/docs/looker-core-dialects.md.txt#additional-commands-mysql)

See the [Looker (Google Cloud core) documentation](https://docs.cloud.google.com/looker/docs/looker-core-dialects.md.txt#using-application-default-credentials-to-connect-to-a-database) for the full procedure.

## Users and security

To perform actions on your database, Looker needs to have a user account on your database.

> [!NOTE]
> **Note:** Skip this procedure if you are on a Looker (Google Cloud core) instance and you want to use Application Default Credentials to authenticate into your database. You will instead use an existing Identity and Access Management (IAM) principal account. See the [Connecting Looker (Google Cloud core) to your database](https://docs.cloud.google.com/looker/docs/looker-core-dialects.md.txt#using-application-default-credentials-to-connect-to-a-database) documentation page for the procedure.

To configure a database user for Looker to use, perform the following steps on your database:

1. Create a database user.

   ```sql
   CREATE USER USERNAME;
   SET PASSWORD FOR USERNAME = PASSWORD ('PASSWORD');
   ```
2. Grant `SELECT` privileges to the database user on the database that you want Looker to query. Replace `database_name` with the name of your database.

   ```sql
   GRANT SELECT ON DATABASE_NAME.* TO USERNAME;
   ```

Once you create the database user, you can enter the database user account credentials in the [**Username**](https://docs.cloud.google.com/looker/docs/2622/db-config-google-cloud-sql.md.txt#username) and [**Password**](https://docs.cloud.google.com/looker/docs/2622/db-config-google-cloud-sql.md.txt#password) fields of the Looker UI when you [create the Looker connection to your database](https://docs.cloud.google.com/looker/docs/2622/db-config-google-cloud-sql.md.txt#creating-the-connection-to-your-database).

## Creating the Looker connection to your database

To create the connection from Looker to your database, follow these steps:

1. In the **Admin** section of Looker, select **Connections** , and then click **Add Connection**.
2. From the **Dialect** drop-down menu, select **Google Cloud SQL**.
3. Fill out the connection details. The majority of the settings are common to most database dialects. See the [Connecting Looker to your database](https://docs.cloud.google.com/looker/docs/2622/connecting-to-your-db.md.txt) documentation page for information. Some of the settings are described next:

   - **Host** : The database hostname that is used to connect to the Google Cloud SQL for MySQL database. For an SSH tunnel, use `localhost`.
   - **Port**: The port used that is to connect to the Google Cloud SQL for MySQL database.
   - **Database**: The name of the Google Cloud SQL for MySQL database instance.
   - **Username** : The username of the account that Looker will use to sign in to Google Cloud SQL for MySQL.

     > [!NOTE]
     > **Note:** [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/looker-core-overview.md.txt) instances also support [Application Default Credentials (ADC)](https://docs.cloud.google.com/docs/authentication/application-default-credentials.md.txt) as a method of authentication for Google Cloud SQL for MySQL. See the [Looker (Google Cloud core) documentation](https://docs.cloud.google.com/looker/docs/looker-core-dialects.md.txt#using-application-default-credentials-to-connect-to-a-database) for more information.

   - **Password** : The password of the account that Looker will use to sign in to Google Cloud SQL for MySQL.

   - **Additional JDBC parameters**: Additional JDBC parameters (optional).

   - **SSL**: If checked, enables an SSL connection; however, SSL connections to Google Cloud SQL for MySQL are not supported by default.

     > [!NOTE]
     > **Note:** Google Cloud SQL for MySQL requires additional steps for configuring SSL connections; see [Configuring SSL/TLS certificates](https://docs.cloud.google.com/sql/docs/mysql/configure-ssl-instance.md.txt). Google Cloud SQL for MySQL creates a server certificate on the creation of each instance, so the custom certificate must be installed on the Looker server for successful SSL connections. This option is available only for [customer-hosted Looker deployments](https://docs.cloud.google.com/looker/docs/2622/customer-hosted-installation-steps.md.txt) that have access to the Looker server.
     >
     > <br />
     >
     > <br />
     >
     > Because of this requirement, a better alternative to SSL is to connect Looker to Google Cloud SQL for MySQL through a [Cloud SQL for MySQL Proxy](https://docs.cloud.google.com/sql/docs/mysql/sql-proxy.md.txt).

   - **Verify SSL**: If checked, SSL verification is enforced. However, SSL connections to Google Cloud are not supported by default.

4. To verify that the connection is successful, click the **Test Connection** button in the **Status details** section at the bottom of the **Connections Settings** page.

5. If Looker displays **Can Connect** , press **Connect** to create the connection.

Your database connection is then added to the list on the Looker [**Connections**](https://docs.cloud.google.com/looker/docs/2622/admin-panel-database-connections.md.txt) **Admin** page.

## PDT support

Google Cloud SQL for MySQL does not support `CREATE TABLE AS SELECT` statements, so you must use the [`create_process`](https://docs.cloud.google.com/looker/docs/2622/reference/param-view-create-process) LookML parameter to define PDTs.

## Supported JDBC parameters

For Cloud SQL for MySQL, Looker supports the following JDBC parameters in the [**Additional JDBC parameters**](https://docs.cloud.google.com/looker/docs/2622/connecting-to-your-db.md.txt#additional_jdbc_parameters) field for the connection. See the documentation for your database for information on these parameters.

- `allowEncodingChanges`
- `ApplicationName`
- `assumeMinServerVersion`
- `binaryTransfer`
- `binaryTransferDisable`
- `binaryTransferEnable`
- `cancelSignalTimeout`
- `connectTimeout`
- `currentSchema`
- `databaseMetadataCacheFields`
- `defaultRowFetchSize`
- `escapeSyntaxCallMode`
- `gssEncMode`
- `hostRecheckSeconds`
- `jaasApplicationName`
- `jaasLogin`
- `kerberosServerName`
- `loadBalanceHosts`
- `loginTimeout`
- `logServerErrorDetail`
- `options`
- `password`
- `preferQueryMode`
- `preparedStatementCacheQueries`
- `prepareThreshold`
- `readOnly`
- `reWriteBatchedInserts`
- `socketTimeout`
- `ssl`
- `sslfactory`
- `sslhostnameverifier`
- `sslmode`
- `sslNegotiation`
- `sslpassword`
- `sslpasswordcallback`
- `stringtype`
- `targetServerType`
- `tcpKeepAlive`
- `unknownLength`
- `user`

## Feature support

For Looker to support some features, your database dialect must also support them.

Google Cloud SQL supports the following features as of Looker 26.22:

| Feature | Supported? |
|---|---|
| Looker (Google Cloud core) | Yes |
| Symmetric aggregates | Yes |
| Derived tables | Yes |
| Persistent SQL derived tables | Yes |
| Persistent native derived tables | No |
| Stable views | No |
| Query killing | Yes |
| SQL-based pivots | Yes |
| Time zones | Yes |
| SSL | Yes |
| Subtotals | Yes |
| JDBC additional params | Yes |
| Case-sensitive | No |
| Location type | Yes |
| List type | Yes |
| Percentile | Yes |
| Distinct percentile | Yes |
| SQL Runner Show Processes | Yes |
| SQL Runner Describe Table | Yes |
| SQL Runner Show Indexes | Yes |
| SQL Runner Select 10 | Yes |
| SQL Runner Count | Yes |
| SQL Explain | Yes |
| OAuth 2.0 credentials | No |
| Context comments | Yes |
| Connection pooling | No |
| HLL sketches | No |
| Aggregate awareness | No |
| Incremental PDTs | No |
| Milliseconds | Yes |
| Microseconds | Yes |
| Materialized views | No |
| Period-over-period measures | No |
| Approximate count distinct | No |
| In-database analytic models | No |
| Custom calendars | No |

## Next steps

After you have created your database connection, [set authentication options](https://docs.cloud.google.com/looker/docs/2622/getting-started-with-users.md.txt).