4
votes

I have created a second generation MySQL SQL instance. I have created a VM on Compute Cloud. I followed the instructions and started the SQL proxy via:

./cloud_sql_proxy -instances=redmine=tcp:3306 -credential_file=/home/sudheer/redmine1.json
2017/12/21 05:43:00 using credential file for authentication; [email protected]
2017/12/21 05:43:00 Listening on 127.0.0.1:3306 for redmine
2017/12/21 05:43:00 Ready for new connections

As you can see, the proxy started and ready to listen to connections. From another terminal, I tried to connect to proxy and I get this message:

mysql -u root --host=127.0.0.1 -p
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

On the proxy side, I see this message:

2017/12/21 05:43:34 New connection for "redmine"
2017/12/21 05:43:35 couldn't connect to "redmine": ensure that the account has access to "redmine" (and make sure there's no typo in that name). Error during createEphemeral for redmine: googleapi: got HTTP response code 404 with body: Not Found

I am not sure what is missing. I provided Project Editor and SQL Client role to the IAM member.

UPDATE: I found the solution myself. The INSTANCE_CONNECTION_NAME was incorrect. It is the format:

project_name:region:instance_name

You can obtain the instance connection name from instance details page.

1
I found the solution myself. The connection name was incorrect. It is in the format project_name:region:instance_name. You can find it in instance details page of console.Sudheer

1 Answers

2
votes

I had the same problem, my solution was

./cloud_sql_proxy -instances=cloud-test-XXXXXXXXXXXXX:europe-west3:test-mysql=tcp:3306

instead of

./cloud_sql_proxy -instances=test-mysql=tcp:3306

what I found in documentation :/