Connect using a SQL Server client Stay organized with collections Save and categorize content based on your preferences.
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:
Create a Cloud SQL instance, including configuring the default user.
See Create instances andSet the password for the default user account.
Optionally, create a Compute Engine VM instance and then connected to the instance using SSH.
SeeCreate and start a VM instance,About SSH connections, orConnect to Windows VMs using RDP.
Determine how you'll connect to your instance.
For the connection options and how to choose from among them, seeAbout connection options.
- Install theSQL Server command-line tools.
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:
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:
- From the client machine or Compute Engine VM instance, useWhat's my IP to see the IP address of the client machine.
- Copy that IP address.
In the Google Cloud console, go to theCloud SQL Instances page.
- To open theOverview page of an instance, click the instance name.
- SelectConnections from the SQL navigation menu.
- Select theNetworking tab.
- 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.
- ClickDone. Then clickSave at the bottom of the page to save your changes.
- 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:
- Confirm that you haveinstalled the client andconfigured access to your instance.
- Use the
sqlcmdcommand 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
- Learn about configuring an instance with a private IP address.
- Learnmore about SQL Server.
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 freeExcept 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.