Connecting to Cloud SQL using gcloud
There is more than one way to connect to a Cloud SQL instance from your machine, but the two most frequently used options are in the following list. The listed prerequisites for both the options require the MySQL client libraries to be installed on the local machine:
- Adding the client machine IP address to authorized networks in Google Cloud Console
- Installing a proxy script on the client machine and using that to connect to Google Cloud SQL
Authorizing the client machine via Google Cloud Console
Get the IP address of the client machine by opening the browser and navigating to this URL: http://ipv4.whatismyv6.com/. Note down the IP address shown on this page for your machine. Open Google Cloud Console in a web browser by navigating to https://console.cloud.google.com. Navigate to the Cloud SQL service and choose the instance you want to connect to. Choose the AUTHORIZATION
tab of the instance and click on the Add network
button. Add the IP address shown as...