This page shows you how to connect to Cloud SQL from a local test
environment using the Cloud SQL Auth Proxy. The Cloud SQL Auth Proxy
provides secure access to your Cloud SQL instance without the need for
authorized networks or for configuring SSL. By using the Cloud SQL Auth Proxy, you can
connect to your Cloud SQL instance securely.
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Click the following button to open Cloud Shell, which provides
command-line access to your Google Cloud resources directly from the browser.
Cloud Shell can be used to run the gcloud commands presented throughout this quickstart.
In the Principal column, find all rows that identify you or a group that
you're included in. To learn which groups you're included in, contact your
administrator.
For all rows that specify or include you, check the Role column to see whether
the list of roles includes the required roles.
In the Password field, enter a password for the sqlserver user.
Click Create instance.
You're returned to the instances list. You can click the new instance right
away to see the details, but it won't be available for other operations until
it initializes and starts.
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.
Click the instance name to open its Overview page.
In the Connect to this instance section, copy the Connection name. The
connection name is in the format projectID:region:instanceID.
Start the Cloud SQL Auth Proxy
Start the Cloud SQL Auth Proxy in its own terminal so you can monitor its output. Replace
INSTANCE_CONNECTION_NAME with the instance connection name you copied
in the previous step.
For Linux environments, use this command to launch the Cloud SQL Auth Proxy:
./cloud-sql-proxyINSTANCE_CONNECTION_NAME
In PowerShell on Windows, use this command to launch the Cloud SQL Auth Proxy:
.\cloud-sql-proxy.exeINSTANCE_CONNECTION_NAME
A message similar to the following appears:
Listening on 127.0.0.1:1433 for INSTANCE_CONNECTION_NAME
Ready for new connections
Run the following command, replacing USER_NAME with your SQL Server username.
sqlcmd-S127.0.0.1-UUSER_NAME
Return to the terminal window where you started the Cloud SQL Auth Proxy. You
should see a message similar to the following:
New connection for myInstance
Clean up
To avoid incurring charges to your Google Cloud account for
the resources used on this page, follow these steps.
In the Google Cloud console, go to the Cloud SQL Instances page.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[],[],null,["# Quickstart: Connect to Cloud SQL for SQL Server using the Cloud SQL Auth Proxy\n\nConnect to Cloud SQL for SQL Server using the Cloud SQL Auth Proxy\n==================================================================\n\n\u003cbr /\u003e\n\n[MySQL](/sql/docs/mysql/quickstart-proxy-test \"View this page for the MySQL database engine\") \\| [PostgreSQL](/sql/docs/postgres/quickstart-proxy-test \"View this page for the PostgreSQL database engine\") \\| SQL Server\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis page shows you how to connect to Cloud SQL from a local test\nenvironment using the Cloud SQL Auth Proxy. The [Cloud SQL Auth Proxy](/sql/docs/sqlserver/sql-proxy)\nprovides secure access to your Cloud SQL instance without the need for\nauthorized networks or for configuring SSL. By using the Cloud SQL Auth Proxy, you can\nconnect to your Cloud SQL instance securely.\n\nThe instructions on this page are for a test environment only and shouldn't be\nused for production environments. For more information\non the configuration required for production environments, see\n[Use the Cloud SQL Auth Proxy in a production environment](/sql/docs/mysql/sql-proxy#production-environment)\nand [Connect using the Cloud SQL Auth Proxy](/sql/docs/mysql/connect-auth-proxy).\n\nBefore you begin\n----------------\n\n| **Note:** The name you use for your project must be between 4 and 30 characters. When you type the name, the form suggests a project ID, which you can edit. The project ID must be between 6 and 30 characters, with a lowercase letter as the first character. You can use a dash, lowercase letter, or digit for the remaining characters, but the last character cannot be a dash.\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n1. Enable the necessary Google Cloud APIs. \n\n ### Console\n\n In the Google Cloud console, go to the **APIs** page.\n\n [Go to APIs](https://console.cloud.google.com/apis)\n Enable the Cloud SQL Admin API.\n\n ### gcloud\n\n Click the following button to open Cloud Shell, which provides\n command-line access to your Google Cloud resources directly from the browser.\n Cloud Shell can be used to run the `gcloud` commands presented throughout this quickstart.\n\n [Open Cloud Shell](/console/sql/instances?cloudshell=true)\n\n\n Run the [`gcloud services enable`](/sdk/gcloud/reference/services/enable) command\n as follows using Cloud Shell to enable the APIs required for this quickstart.:\n\n ```bash\n gcloud services enable sqladmin.googleapis.com\n ```\n\n This command enables the following APIs:\n - Cloud SQL Admin API\n2.\n\n Make sure that you have the following role or roles on the project:\n\n Cloud SQL Admin (`roles/cloudsql.admin`), Cloud SQL Viewer (`roles/cloudsql.viewer`)\n\n #### Check for the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n 2. Select the project.\n 3.\n In the **Principal** column, find all rows that identify you or a group that\n you're included in. To learn which groups you're included in, contact your\n administrator.\n\n 4. For all rows that specify or include you, check the **Role** column to see whether the list of roles includes the required roles.\n\n #### Grant the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n 2. Select the project.\n 3. Click person_add **Grant access**.\n 4.\n In the **New principals** field, enter your user identifier.\n\n This is typically the email address for a Google Account.\n\n 5. In the **Select a role** list, select a role.\n 6. To grant additional roles, click add **Add\n another role** and add each additional role.\n 7. Click **Save**.\n\nCreate a Cloud SQL instance\n---------------------------\n\nIn this quickstart, you use the Google Cloud console. To use the\n[gcloud CLI](/sdk/gcloud), cURL, or PowerShell, see\n[Create instances](/sql/docs/sqlserver/create-instance).\n\n1. In the Google Cloud console, go to the **Cloud SQL Instances** page.\n\n [Go to Cloud SQL Instances](https://console.cloud.google.com/sql)\n2. Click **Create instance**.\n3. Click **Choose SQL Server**.\n4. In the **Instance ID** field, enter `myinstance`.\n5. In the **Password** field, enter a password for the `sqlserver` user.\n6. Click **Create instance**.\n\n You're returned to the instances list. You can click the new instance right\n away to see the details, but it won't be available for other operations until\n it initializes and starts.\n | **Note:** In this example, the instance is created using default settings, including a public IP address.\n\n### Debian/Ubuntu\n\nFor Debian/Ubuntu, install the applicable SQL Server command-line tools using\n[these instructions](https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-2017#ubuntu).\n\n### CentOS/RHEL\n\nFor CentOS/RHEL, install the applicable SQL Server command-line tools using\n[these instructions](https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-2017#install-tools-on-rhel-7).\n\n### openSUSE\n\nFor openSUSE, install the applicable SQL Server command-line tools using\n[these instructions](https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-suse?view=sql-server-2017#tools).\n\n### Other platforms\n\nSee the [landing page](https://docs.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-database-engine?view=sql-server-2017) for installing SQL Server, as well as the\n[SQL Server downloads page](https://www.microsoft.com/en-us/sql-server/sql-server-downloads).\n\nInstall the Cloud SQL Auth Proxy client\n---------------------------------------\n\nFor installation, see\n[Installing the Cloud SQL Auth Proxy](/sql/docs/sqlserver/connect-auth-proxy#install).\n\nGet the instance connection name\n--------------------------------\n\n1. In the Google Cloud console, go to the **Cloud SQL Instances** page.\n\n [Go to Cloud SQL Instances](https://console.cloud.google.com/sql)\n2. Click the instance name to open its **Overview** page.\n3. In the **Connect to this instance** section, copy the **Connection name** . The connection name is in the format `projectID:region:instanceID`.\n\nStart the Cloud SQL Auth Proxy\n------------------------------\n\nStart the Cloud SQL Auth Proxy in its own terminal so you can monitor its output. Replace\n`INSTANCE_CONNECTION_NAME` with the instance connection name you copied\nin the previous step.\n\nFor Linux environments, use this command to launch the Cloud SQL Auth Proxy: \n\n```bash\n./cloud-sql-proxy INSTANCE_CONNECTION_NAME\n```\n\n\u003cbr /\u003e\n\nIn PowerShell on Windows, use this command to launch the Cloud SQL Auth Proxy: \n\n```bash\n.\\cloud-sql-proxy.exe INSTANCE_CONNECTION_NAME\n```\n\n\u003cbr /\u003e\n\nA message similar to the following appears: \n\n```\nListening on 127.0.0.1:1433 for INSTANCE_CONNECTION_NAME\nReady for new connections\n```\n\nRun the following command, replacing `USER_NAME` with your SQL Server username.\n\n\u003cbr /\u003e\n\n```bash\nsqlcmd -S 127.0.0.1 -U USER_NAME\n```\n\nReturn to the terminal window where you started the Cloud SQL Auth Proxy. You\nshould see a message similar to the following:\n\n`New connection for `*myInstance*\n\nClean up\n--------\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, follow these steps.\n\n1. In the Google Cloud console, go to the **Cloud SQL Instances** page.\n\n [Go to Cloud SQL Instances](https://console.cloud.google.com/sql)\n2. Select the `myinstance` instance to open the **Instance details** page.\n3. In the icon bar at the top of the page, click **Delete**.\n4. In the **Delete instance** window, type your instance's name and then click **Delete**.\n\n### Optional cleanup steps\n\nIf you're not using the APIs that were enabled as part of this quickstart, you\ncan disable them.\n\n- APIs that were enabled within this quickstart:\n - Cloud SQL Admin API\n\n1.\n\n In the Google Cloud console, go to the **APIs** page.\n\n [Go to APIs](https://console.cloud.google.com/apis)\n\n \u003cbr /\u003e\n\n2. Select the Cloud SQL Admin API and then click the\n **Disable API** button.\n\nWhat's next\n-----------\n\n- See how to [troubleshoot information for the Cloud SQL Auth Proxy](/sql/docs/sqlserver/connect-auth-proxy#troubleshooting).\n\n- Learn more [about the Cloud SQL Auth Proxy](/sql/docs/sqlserver/sql-proxy)."]]