# Connect to Google Cloud SQL instances

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/go/2026.3/llms.txt).

> **TL;DR**
> Different connecting options require the following software:
>
>
>
> [Google Cloud SDK](https://cloud.google.com/sdk/docs/install)
>
>
>
> [Cloud SQL Proxy client](https://cloud.google.com/sql/docs/mysql/quickstart-proxy-test#install-proxy)
>
>
>
> [Cloud SQL Connector for Java](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/releases)

Within the framework of this topic, we are going to use a PostgreSQL instance on the Google Cloud Platform. But you can use the same instructions to connect to MySQL and Microsoft SQL Server instances of Google Cloud SQL.

If you have not created the instance yet, refer to [Creating instances at cloud.google.com](https://cloud.google.com/sql/docs/postgres/create-instance).

From GoLand, you can connect to your instances by using the following options.

* [Cloud SQL Proxy client](#configuring-connections-with-the-cloud-sql-proxy-client): a command-line tool that establishes the proxy connection and provides secure access to your instances. When the Cloud SQL Proxy client runs, you do not need to add your IP to authorized networks or configure SSL. You can read more about the Cloud SQL Proxy in [this article at cloud.google.com](https://cloud.google.com/sql/docs/mysql/sql-proxy). The connection is secured. To connect to your instance, you need [Google Cloud SDK](https://cloud.google.com/sdk/docs/install) and [the Cloud SQL Proxy client](https://cloud.google.com/sql/docs/mysql/quickstart-proxy-test#install-proxy).

* [Cloud SQL Connector for Java](#configuring-connections-with-the-cloud-sql-connector-for-java): libraries for JDBC drivers by using which you can connect securely to Cloud SQL databases. These libraries are available on [the Release page of the cloud-sql-jdbc-socket-factory repository at github.com](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/releases). The connection is secured. To connect to your instance, you need [Google Cloud SDK](https://cloud.google.com/sdk/docs/install) and the JAR library file of the Cloud SQL Connector for Java.

* [Adding your network to authorized networks](#adding-your-network-to-authorized-networks): adding your network to the list of authorized sources in the Google Cloud Console. After this procedure, you can connect to the PostgreSQL instance from your network by using the IP address of your instance. The connection is not secured (no encryption). To connect to your instance, you need to add your IP address or a range of IP addresses to authorized networks.

## Configuring Google Cloud SDK

This configuration procedure is common for [the Cloud SQL Proxy client](#configuring-connections-with-the-cloud-sql-proxy-client) and [the Cloud SQL
Connector for
Java](#configuring-connections-with-the-cloud-sql-connector-for-java). If you plan to add your network to the list of authorized networks, you can skip this part.

To complete the connection's configuration, you need [Google Cloud SDK](https://cloud.google.com/sdk/docs/install).

Google Cloud SDK includes the `gcloud` utility that manages authentication and interactions with the Google Cloud Platform API. For more information about `gcloud`, refer to [the gcloud reference at
cloud.google.com](https://cloud.google.com/sdk/gcloud/reference).

Procedure: Step 1. Installing Google Cloud SDK

For more information about the installation process, refer to [the Installing Google Cloud SDK guide at cloud.google.com](https://cloud.google.com/sdk/docs/install). This procedure provides a summary of steps from the guide.

1. Download and extract [the Google Cloud SDK archive](https://cloud.google.com/sdk/docs/install).

2. Run the `gcloud init` command to initialize the SDK. Follow the installation wizard in the command prompt.

```SHELL
./google-cloud-sdk/bin/gcloud init
```

![Run gcloud init to initialize the SDK:](https://resources.jetbrains.com/help/img/idea/2026.3/db_run_gcloud_init_to_initialize_the_sdk.png)

Procedure: Step 2. Register your application for the Cloud SQL Admin API

1. Click the Enable the API button in [the
Enable the Cloud SQL Admin API section](https://cloud.google.com/sql/docs/mysql/quickstart-proxy-test#enable-api).

2. Select your project in the dropdown and click Continue.

You have to enable the Cloud SQL Admin API for each database project if you want to connect to the database in this project. For example, one project uses PostgreSQL, another project uses MySQL. You need to enable the API for both projects.

![Cloud SQL Admin API](https://resources.jetbrains.com/help/img/idea/2026.3/db_cloud_sql_admin_api.animated.gif)

Procedure: Step 3. Configure authentication

1. Run the following command to authenticate the `gcloud` tool.

```SHELL
gcloud auth login
```

This command obtains your credentials and stores them in `~/.config/gcloud/`. Now you can run `gcloud` commands from your terminal, and it will find your credentials automatically.

![Authenticate the gcloud tool](https://resources.jetbrains.com/help/img/idea/2026.3/db_gcloud_auth_login.png)

2. Run the following command to obtain credentials for the Application Default Credentials (ADC) library.

```SHELL
gcloud auth application-default login
```

This command obtains your credentials for the ADC library. Now, any code or SDK that is running on your computer will be able to find the credentials automatically.

![Authenticate the connection to the Cloud SQL server](https://resources.jetbrains.com/help/img/idea/2026.3/db_authenticate_the_connection_to_the_cloud_sql_server.png)

## Configuring connections with the Cloud SQL Proxy client

> **Note:**
> Ensure that you have [correctly configured Google Cloud SDK](#configuring-google-cloud-sdk): initialized the `gcloud` tool; enabled the Cloud SQL Admin API; authenticated the gcloud tool; acquired credentials for the ADC library.

[The Cloud SQL Proxy client](https://cloud.google.com/sql/docs/mysql/quickstart-proxy-test#install-proxy) communicates with your database through a secure tunnel. Read more about the client in [About the Cloud SQL Proxy at cloud.google.com](https://cloud.google.com/sql/docs/mysql/sql-proxy).

Procedure: Step 1. Run the Cloud SQL Proxy client

1. Download the Cloud SQL Proxy client. See installation instructions in [Install the Cloud SQL Proxy client on your local machine at cloud.google.com](https://cloud.google.com/sql/docs/mysql/quickstart-proxy-test#install-proxy).

2. Start the proxy in the command prompt.

```SHELL
./cloud-sql-proxy --port 3306 <INSTANCE_CONNECTION_NAME>
```

Replace the `connection_name` with the connection name of your instance. You can find this information on the Overview  page of your instance. If the `3306` port is already in use, change it to another port (for example, 5435).

![The connection name of your instance on the Overview page](https://resources.jetbrains.com/help/img/idea/2026.3/db_connection_name_of_your_instance.png)

Procedure: Step 2. Create a data source

1. Ensure that the Cloud SQL Proxy client is running (see [Step 1](#step-1-run-the-cloud-sql-proxy-client)).

2. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com/help/img/idea/2026.3/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (VSCode), `Shift+Enter` (VSCode (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com/help/img/idea/2026.3/open_data_sources_and_drivers_dialog.png)

3. In the  Data Sources and Drivers  dialog, click the Add icon (![The Add icon](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg)) and select your database vendor (in our case, PostgreSQL).

4. Check if there is a Download missing driver files link at the bottom of the connection settings area. Click this link to download drivers that are required to interact with a database. For a direct download link, refer to the [JetBrains JDBC drivers](https://www.jetbrains.com/datagrip/jdbc-drivers/) page.

![The Download missing driver files link](https://resources.jetbrains.com/help/img/idea/2026.3/db_connection_download_missing_drivers_link.png)

Location for the downloaded JDBC drivers is the [GoLand configuration directory](directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html#config-directory).

You can also use your drivers for the database instead of the provided ones. For more information about connecting to a database with your driver, refer to [Add a user driver to an existing connection](jdbc-drivers.html#configure_a_jdbc_driver_for_an_existing_data_source).

If there is no Download missing driver files link, then you already have the required drivers.

5. From the  Authentication  list, select User & Password.

6. Specify connection details.

* Host: `127.0.0.1`. You are connecting to a local machine because you use the Cloud SQL Proxy client.

* Port: `3306`, or any other port that you selected for the proxy (for example, `5435`).

* User: a user who has permission to access the database.

* Password: password of a user.

* Database: a database to which you want to connect.

7. Ensure that the database connection can be established using the provided details. To do this, click the Test Connection  link at the bottom of the connection details section.

If you encounter any connection issues, refer to the [Cannot connect to a database](connectivity-problems.html) page.

8. (Optional) By default, only the default database and schema are project and dataset are database is schema is keyspace is namespace is introspected and available to work with. If you also want to work with other databases and schemas projects and datasets databases, schemas, and shared databases databases schemas keyspaces namespaces, in the Schemas tab, select them for the introspection.

![Schemas tab of the Data Sources and Drivers dialog](https://resources.jetbrains.com/help/img/idea/2026.3/db_connection_schemas_tab.png)

9. Click OK to create the data source.

10. Find your new data source in the    Database   tool window   .

* For more information about the Database tool window , see the corresponding [reference topic](database-tool-window.html). > **Tip:** > To see more databases and schemas projects and datasets databases, schemas, and shared databases databases schemas keyspaces namespaces under your new data source node, click the N of M button and select the ones you need. GoLand will introspect and show them. > > > > ![Select databases and schemas to introspect and display in the Database tool window](https://resources.jetbrains.com/help/img/idea/2026.3/connection_flow_show_databases_and_schemas.png)

* For more information about working with database objects in GoLand, refer to [Database objects](database-objects.html).

* To write and run queries, open the default [query console](query-consoles.html) by clicking the data source and pressing `F4` (Windows), `⌘ ↓` (macOS), `F4` (IntelliJ IDEA Classic (macOS)), `F4` (macOS System Shortcuts), `F4` (XWin), `F4` (GNOME), `F4` (KDE), `F4` (Emacs), `F4` (Sublime Text), `F4` (Sublime Text (macOS)), `F4` (VSCode), `F4` (VSCode (macOS)).

* To view and edit data of a database object, open [Data editor and viewer](data-editor-and-viewer.html) by double-clicking the object.

![step-4-run-the-cloud-sql-proxy-client](https://resources.jetbrains.com/help/img/idea/2026.3/step_2_create_a_connection_in_product.png)

## Configuring connections with the Cloud SQL Connector for Java

> **Note:**
> Ensure that you have [correctly configured Google Cloud SDK](#configuring-google-cloud-sdk): initialized the `gcloud` tool; enabled the Cloud SQL Admin API; authenticated the gcloud tool; acquired credentials for the ADC library.

Procedure: Create a data source

1. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com/help/img/idea/2026.3/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (VSCode), `Shift+Enter` (VSCode (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com/help/img/idea/2026.3/open_data_sources_and_drivers_dialog.png)

2. In the    Database   tool window   ,  click ![the New icon](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg) New on the toolbar and   select the database you want to create a data source for.

![The Add data source button](https://resources.jetbrains.com/help/img/idea/2026.3/db_click_add_data_source.png)

3. In the Connection type list, select URL only.

4. In the Driver list, select the driver:

* PostgreSQL: PostgreSQL (CloudSQL Proxy)

* MySQL: MySQL (CloudSQL Proxy)

* Microsoft SQL Server: Microsoft SQL Server (CloudSQL Proxy)

5. Check if there is a Download missing driver files link at the bottom of the connection settings area. Click this link to download drivers that are required to interact with a database.

![The Download missing driver files link](https://resources.jetbrains.com/help/img/idea/2026.3/db_connection_download_missing_drivers_link.png)

6. In the URL field, paste the URL in the following format:

* PostgreSQL: ``` jdbc:postgresql:///<DATABASE_NAME>?cloudSqlInstance=<INSTANCE_CONNECTION_NAME>&user=<USER_NAME>&password=<USER_PASSWORD> ```

* MySQL: ``` jdbc:mysql:///<DATABASE_NAME>?cloudSqlInstance=<INSTANCE_CONNECTION_NAME>&user=<USER_NAME>&password=<USER_PASSWORD> ```

* Microsoft SQL Server: ``` jdbc:sqlserver://;databaseName=<DATABASE_NAME>;user=<USER_NAME>;password=<USER_PASSWORD> ```

, where

* DATABASE_NAME: the database name to which you want to connect.

* INSTANCE_CONNECTION_NAME: the instance connection name. You can find this information on the Overview page of your instance. ![The connection name of your instance on the Overview page](https://resources.jetbrains.com/help/img/idea/2026.3/db_connection_name_of_your_instance.png)

* USER_NAME: a user name that has access to the database.

* USER_PASSWORD: a user's password.

Note that you do not need to specify the host. Due to the properties that you set for the driver, the IP address of your instance will be detected automatically.

Your URL might look something like this:

* PostgreSQL: ``` jdbc:postgresql:///guest?cloudSqlInstance=crucial-study-301709:us-central1:postgres&user=guest&password=guest ```

* MySQL: ``` jdbc:mysql:///guest?cloudSqlInstance=mysql-304410:europe-west3:mysql&user=guest&password=guest ```

* Microsoft SQL Server: ``` jdbc:sqlserver://;databaseName=guest;user=sqlserver;password=guest ```

Alternatively, in the Connection type list, select Default and enter your connection details in the available fields.

7. Click the Test Connection link at the bottom of the connection details area to initiate a test connection to your database.

![Test Connection link](https://resources.jetbrains.com/help/img/idea/2026.3/db_test_connection_link.png)

8. Click  OK to save your new data source.

![PostgreSQL data source settings](https://resources.jetbrains.com/help/img/idea/2026.3/db_cloud_sql_instance_crucial_study_301709.png)

## Adding your network to authorized networks

> **Note:**
> This type of connection is unencrypted. To secure your connection, consider authorizing with [SSL/TLS certificates](https://cloud.google.com/sql/docs/mysql/authorize-ssl).

To complete this part of the guide, you need to know your external IP address or a range of IP addresses. Use [the
CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) (for example, `192.168.100.14/24`).

Procedure: Step 1. Add your network to authorized networks

1. Open a page of your Cloud SQL Instance.

2. Select the Connections tab and click Add network.

3. In the Network field, type your external IP address or a range of IP addresses in the CIDR notation.

4. Click Done and then Save.

Wait until your instance is updated.

![Add your network to authorized networks](https://resources.jetbrains.com/help/img/idea/2026.3/db_add_your_network_to_authorized_networks.png)

Procedure: Step 2. Create a data source

1. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com/help/img/idea/2026.3/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (VSCode), `Shift+Enter` (VSCode (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com/help/img/idea/2026.3/open_data_sources_and_drivers_dialog.png)

2. In the Data Sources and Drivers dialog, click the Add icon (![The Add icon](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg)) and select your database vendor (for example, PostgreSQL).

3. Check if there is a Download missing driver files link at the bottom of the connection settings area. Click this link to download drivers that are required to interact with a database. For a direct download link, refer to the [JetBrains JDBC drivers](https://www.jetbrains.com/datagrip/jdbc-drivers/) page.

![The Download missing driver files link](https://resources.jetbrains.com/help/img/idea/2026.3/db_connection_download_missing_drivers_link.png)

Location for the downloaded JDBC drivers is the [GoLand configuration directory](directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html#config-directory).

You can also use your drivers for the database instead of the provided ones. For more information about connecting to a database with your driver, refer to [Add a user driver to an existing connection](jdbc-drivers.html#configure_a_jdbc_driver_for_an_existing_data_source).

If there is no Download missing driver files link, then you already have the required drivers.

4. In the Host field, type the IP address of your PostgreSQL instance. You can find this IP address on the overview page of your instance.

5. From the Authentication list, select User & Password.

6. In the User field, type the user name that has access to the database.

7. In the Password field, type the user's password.

8. In the Database field, type the database name to which you want to connect.

9. Ensure that the database connection can be established using the provided details. To do this, click the Test Connection  link at the bottom of the connection details section.

If you encounter any connection issues, refer to the [Cannot connect to a database](connectivity-problems.html) page.

10. (Optional) By default, only the default database and schema are project and dataset are database is schema is keyspace is namespace is introspected and available to work with. If you also want to work with other databases and schemas projects and datasets databases, schemas, and shared databases databases schemas keyspaces namespaces, in the Schemas tab, select them for the introspection.

![Schemas tab of the Data Sources and Drivers dialog](https://resources.jetbrains.com/help/img/idea/2026.3/db_connection_schemas_tab.png)

11. Click OK to create the data source.

12. Find your new data source in the    Database   tool window   .

* For more information about the Database tool window , see the corresponding [reference topic](database-tool-window.html). > **Tip:** > To see more databases and schemas projects and datasets databases, schemas, and shared databases databases schemas keyspaces namespaces under your new data source node, click the N of M button and select the ones you need. GoLand will introspect and show them. > > > > ![Select databases and schemas to introspect and display in the Database tool window](https://resources.jetbrains.com/help/img/idea/2026.3/connection_flow_show_databases_and_schemas.png)

* For more information about working with database objects in GoLand, refer to [Database objects](database-objects.html).

* To write and run queries, open the default [query console](query-consoles.html) by clicking the data source and pressing `F4` (Windows), `⌘ ↓` (macOS), `F4` (IntelliJ IDEA Classic (macOS)), `F4` (macOS System Shortcuts), `F4` (XWin), `F4` (GNOME), `F4` (KDE), `F4` (Emacs), `F4` (Sublime Text), `F4` (Sublime Text (macOS)), `F4` (VSCode), `F4` (VSCode (macOS)).

* To view and edit data of a database object, open [Data editor and viewer](data-editor-and-viewer.html) by double-clicking the object.

![Connect to Cloud SQL with an authorized network](https://resources.jetbrains.com/help/img/idea/2026.3/db_connect_to_cloud_sql_with_white_ip.png)

