Cannot Connect to Cloud SQL from Cloud Shell by Proxy

510 views
Skip to first unread message

Yin-Shen Chao

unread,
Feb 17, 2017, 8:53:38 AM2/17/17
to Google Cloud SQL discuss
Dear google-cloud-sql-discuss,


I tried to connect to a cloud sql instance from cloud shell by proxy. The API seems to go through, but I don't know why I cannot connect. The context is following,

Error message from Proxy

couldn't connect to playground-158007:asia-east1:auth-instance2": dial tcp 104.199.247.40:3307: getsockopt: connection timed out"

Error Message from Client

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

Steps:

1. have the sql instance running.
2. create a service account with Cloud SQL API permission
3. Get the JASON file to connect, and the API log shows the successful connection.Part of the API log

serviceName: "cloudsql.googleapis.com"

methodName: "cloudsql.instances.connect"

./cloud_sql_proxy -instances=playground-158007:asia-east1:auth-instance2=tcp:3306 -credential_file=playground-3d345c8ab9b3.json

4. "gcloud beta sql connect auth-instance2 --user=root" can connect.

My db instance: playground-158007:asia-east1:auth-instance2

Please let me know if you have some clue. Any pointer for debugging is welcome.

Thanks in advance.

Yin-shen

David Newgas

unread,
Feb 17, 2017, 12:34:27 PM2/17/17
to Google Cloud SQL discuss
Please see my reply in the other thread.

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/57b8c98f-9d77-4e84-9b42-fbf4fadae2a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jerry Lin

unread,
Apr 26, 2019, 9:48:36 AM4/26/19
to Google Cloud SQL discuss
Which thread? I tried to search but keywords did me no favor

Harmit Rishi (Cloud Platform Support)

unread,
Apr 29, 2019, 1:56:30 PM4/29/19
to google-cloud...@googlegroups.com

Hello Jerry,


I was searching for the thread that was being referenced and could not find it due to this post being close to two years old. I would suggest that you follow the official guide provided by Google for connecting MySQL Client with the use Cloud SQL Proxy here. This will ensure you are not following any of the outdated steps mentioned above.

Please let me know if you encounter any issues when following to this guide.  

Reply all
Reply to author
Forward
0 new messages