Tuesday, March 15, 2016

Re: [google-cloud-sql-discuss] Re: "Lost connection to MySQL server" in Cloud Proxy

Can you clarify which error you are getting from the proxy right now?

Is it this one:
$ mysql -u DB_USER_NAME -S /tmp/cloudsql/PROJECT_NAME:asia-east1:INSTANCE_NAME
2016/03/14 06:32:19 couldn't connect to "PROJECT_NAME:asia-east1:INSTANCE_NAME": POST "https://www.googleapis.com/sql/v1beta4/projects/PROJECT_NAME/instances/INSTANCE_NAME/createEphemeral": 403 Forbidden; Body="{\n \"error\": {\n  \"errors\": [\n   {\n    \"domain\": \"global\",\n    \"reason\": \"insufficientPermissions\",\n    \"message\": \"Insufficient Permission\"\n   }\n  ],\n  \"code\": 403,\n  \"message\": \"Insufficient Permission\"\n }\n}\n"; read error: <nil>
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

or this one:
2016/03/14 06:14:25 couldn't connect to "PROJECT_NAME:asia-east1:INSTANCE_NAME": dial tcp CLOUD_SQL_INSTANCE_IP:3307: getsockopt: connection timed out
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

For (1), I think the problem is that the service account doesn't have the necessary scopes to call the Cloud SQL API. When creating a Compute Engine VM, there's a setting to select "Identity and API access". The default setting does not include Cloud SQL so the service account will not be able to communicate with the Cloud SQL API.
This is something we need to document better and provide a better error message for.
Unfortunately it is not possible to change the scopes on an existing VMs. The option is either to re-create the VM, if that's possible, or use credentials for a different service account.




On Tue, Mar 15, 2016 at 9:12 PM 小川純平 <ogawa@growaspeople.org> wrote:
Thanks Vadim.

I've run telnet on GCE instance and it seems successfully connected to Cloud SQL instance.


$ telnet <INSTANCE IP> 3307
Trying <INSTANCE IP>...
Connected to <INSTANCE IP>.
Escape character is '^]'.

Just after running above command, I retried to connect from mysql, but no luck.


$ mysql -u DB_USER_NAME -S /tmp/cloudsql/PROJECT_NAME:asia-east1:INSTANCE_NAME
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/307e30bc-a668-4e90-a738-68685ff2862e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/CABDU3p3J%3DjJy24khwuv%2BrAn3ODpU1Lh%2BE9ycJV-yYBdwNStcrw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment