Connecting using a database client from a local machine or Compute Engine

This page describes how to connect a SQL Server client, whether running locally on your client machine or on a Compute Engine VM, to your Cloud SQL instance.

Before you begin

Before you can start using a client, you must have:

Using a client on a local machine or a Compute Engine VM

Using a sqlcmd client to connect to your Cloud SQL instance involves three high-level tasks:

  1. Install the client.
  2. Configure access to your Cloud SQL instance.
  3. Connect to your Cloud SQL instance.

Install the client

To install the client:

Debian/Ubuntu

For Debian/Ubuntu, install the applicable SQL Server command-line tools using these instructions.

CentOS/RHEL

For CentOS/RHEL, install the applicable SQL Server command-line tools using these instructions.

openSUSE

For openSUSE, install the applicable SQL Server command-line tools using these instructions.

Other platforms

See the landing page for installing SQL Server, as well as the SQL Server downloads page.

Configure access to your Cloud SQL instance

To configure access to your instance:

  1. From the client machine or Compute Engine VM instance, use What's my IP to see the IP address of the client machine.
  2. Copy that IP address.
  3. In the Google Cloud Console, go to the Cloud SQL Instances page.

    Go to Cloud SQL Instances

  4. Click the instance name to open its Overview page.
  5. Select Connections from the SQL navigation menu.
  6. In the Authorized networks section, click Add network and enter the IP address of the machine where the client is installed.
  7. Click Done. Then click Save at the bottom of the page to save your changes.
  8. Connect to your instance.

Connect to your Cloud SQL instance

To connect to your instance:

  1. Confirm that you have installed the client and configured access to your instance.
  2. Use the sqlcmd command to connect, by following steps similar to those in the examples on the SQL Server quickstart and Use the utility pages.

To connect to your instance using SSL:

Use the instructions in the Client Initiated Encryption section, and related sections, of the Encrypting Connections to SQL Server on Linux page.

What's next

Try it for yourself

If you're new to Google Cloud, create an account to evaluate how Cloud SQL performs in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.

Try Cloud SQL free