Connect using a SQL Server client

MySQL  |  PostgreSQL  |  SQL Server

You can use the SQL Server command-line client to connect to Cloud SQL. Thispage describes how to connect a SQL Server client, whether runninglocally on your client machine or on a Compute Engine VM, to yourCloud SQL instance.

Note: For information about connecting aclient to a Cloud SQL instance using the Cloud SQL Auth Proxy, seeConnect using the Cloud SQL Auth Proxy.For information about connecting using private IP, seeConfigure private IP.

Before you begin

Before you can use asqlcmd client to connect to your Cloud SQLinstance, do the following:

Use a SQL Server client on a local machine or a Compute Engine VM

Using asqlcmd client to connect to your Cloud SQLinstance 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 thesqlcmd client, do the following:

Debian/Ubuntu

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

CentOS/RHEL

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

openSUSE

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

Other platforms

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

Configure access to your Cloud SQLinstance

To configure access to your instance, do the following:

  1. From the client machine or Compute Engine VM instance, useWhat'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 theCloud SQL Instances page.

    Go to Cloud SQL Instances

  4. To open theOverview page of an instance, click the instance name.
  5. SelectConnections from the SQL navigation menu.
  6. Select theNetworking tab.
  7. In theAuthorized networks section, clickAdd network and enter the IP address of the machine where the client is installed.Note: The IP addresses must be IPv4. That is, the IP addresses of the instance, and of the client machine that you authorize, both must be IPv4.
  8. ClickDone. Then clickSave at the bottom of the page to save your changes.
  9. Connect to your instance.

Connect to your Cloud SQL instance

To let you connect without encryption, the instance must haverequireSslset tofalse. In the Google Cloud console, theAllow only SSL connections checkbox must be cleared.

For more information about the SSL/TLS configuration of your instance, seeConfigure SSL/TLS certificates.

To connect to your instance, do the following:

  1. Confirm that you haveinstalled the client andconfigured access to your instance.
  2. Use thesqlcmd command to connect, by following steps similar to those in the examples on the SQL Server quickstart andUse the utility pages.

Connect to your Cloud SQL instance using SSL/TLS

Use the instructions in theClient Initiated Encryption section, and related sections, of theEncrypting 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

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-17 UTC.