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.
The instructions on this page are for a test environment only and shouldn't be used for production environments. For more information on the configuration required for production environments, see Use the Cloud SQL Auth Proxy in a production environment and Connect using the Cloud SQL Auth Proxy.
Before you begin 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.In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
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.Make sure that billing is enabled for your Google Cloud project.
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
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.Make sure that billing is enabled for your Google Cloud project.
In the Google Cloud console, go to the APIs page.
Enable the Cloud SQL Admin API. gcloudClick 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.
Run the gcloud services enable
command as follows using Cloud Shell to enable the APIs required for this quickstart.:
gcloud services enable sqladmin.googleapis.com
This command enables the following APIs:
Make sure that you have the following role or roles on the project: Cloud SQL Admin (roles/cloudsql.admin
), Cloud SQL Viewer (roles/cloudsql.viewer
)
In the Google Cloud console, go to the IAM page.
Go to IAMIn 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.
In the Google Cloud console, go to the IAM page.
Go to IAMIn the New principals field, enter your user identifier. This is typically the email address for a Google Account.
In this quickstart, you use the Google Cloud console. To use the gcloud CLI, cURL, or PowerShell, see Create instances.
In the Google Cloud console, go to the Cloud SQL Instances page.
myinstance
.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.
Note: In this example, the instance is created using default settings, including a public IP address.For installation, see Installing the Cloud SQL Auth Proxy.
Get the instance connection nameIn the Google Cloud console, go to the Cloud SQL Instances page.
projectID:region:instanceID
.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-proxy INSTANCE_CONNECTION_NAME
In PowerShell on Windows, use this command to launch the Cloud SQL Auth Proxy:
.\cloud-sql-proxy.exe INSTANCE_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 -S 127.0.0.1 -U USER_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
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.
myinstance
instance to open the Instance details page.If you're not using the APIs that were enabled as part of this quickstart, you can disable them.
In the Google Cloud console, go to the APIs page.
Select the Cloud SQL Admin API and then click the Disable API button.
See how to troubleshoot information for the Cloud SQL Auth Proxy.
Learn more about the Cloud SQL Auth Proxy.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4