Google cloud platform 无法通过云SQL代理连接到MySQL

Google cloud platform 无法通过云SQL代理连接到MySQL,google-cloud-platform,google-compute-engine,google-cloud-sql,cloud-sql-proxy,Google Cloud Platform,Google Compute Engine,Google Cloud Sql,Cloud Sql Proxy,我已经创建了第二代MySQL SQL实例。我已经在计算云上创建了一个虚拟机。我按照说明通过以下方式启动了SQL代理: ./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=redmine1@gavika-test-cloud.iam.g

我已经创建了第二代MySQL SQL实例。我已经在计算云上创建了一个虚拟机。我按照说明通过以下方式启动了SQL代理:

./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=redmine1@gavika-test-cloud.iam.gserviceaccount.com
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
如您所见,代理已启动并准备侦听连接。从另一个终端,我尝试连接到代理,我收到以下消息:

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
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
在代理端,我看到以下消息:

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
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
我不知道少了什么。我为IAM成员提供了项目编辑器和SQL客户端角色

更新:我自己找到了解决方案。 实例\连接\名称不正确。格式如下:

project_name:region:instance_name

您可以从实例详细信息页面获取实例连接名称

我也有同样的问题,我的解决方案是

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

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

我在文档中的发现://

我自己找到了解决方案。连接名称不正确。它的格式为project\u name:region:instance\u name。您可以在控制台的实例详细信息页面中找到它。