我正在遵循GAE的Django示例,并且在使用Google Cloud Shell通过代理连接Cloud SQL实例时遇到了问题。可能与权限设置有关,因为我看到请求未经授权。
其他上下文:
1. "gcloud beta sql connect auth-instance --user=root" 可以正常连接。 2. 我有一个SQL Proxy客户端的服务账号。
我可能漏掉了某些东西。能否有人请指点一下?先行致谢。
代理日志:
客户端日志:
我也尝试使用凭据文件,但仍然没有成功。
其他上下文:
1. "gcloud beta sql connect auth-instance --user=root" 可以正常连接。 2. 我有一个SQL Proxy客户端的服务账号。
我可能漏掉了某些东西。能否有人请指点一下?先行致谢。
代理日志:
./cloud_sql_proxy -instances=auth-158903:asia-east1:auth-instance=tcp:3306
2017/02/17 14:00:59 Listening on 127.0.0.1:3306 for auth-158903:asia-east1:auth-instance
2017/02/17 14:00:59 Ready for new connections
2017/02/17 14:01:07 New connection for "auth-158903:asia-east1:auth-instance"
2017/02/17 14:03:16 couldn't connect to "auth-158903:asia-east1:auth-instance": dial tcp 107.167.191.26:3307: getsockopt: connection timed out
客户端日志:
mysql -u root -p --host 127.0.0.1
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
我也尝试使用凭据文件,但仍然没有成功。
./cloud_sql_proxy -instances=auth-158903:asia-east1:auth-instance=tcp:3306 -credential_file=Auth-2eede8ae0d0b.jason
2017/02/17 14:21:36 using credential file for authentication; email=sql-proxy-client@auth-158903.iam.gserviceaccount.com
2017/02/17 14:21:36 Listening on 127.0.0.1:3306 for auth-158903:asia-east1:auth-instance
2017/02/17 14:21:36 Ready for new connections
2017/02/17 14:21:46 New connection for "auth-158903:asia-east1:auth-instance"
2017/02/17 14:21:48 couldn't connect to "auth-158903:asia-east1:auth-instance": ensure that the account has access to "auth-158903:asia-east1:auth-instance" (and make sure there's no typo in that name). Error during get instance auth-158903:asia-east1:auth-instance: googleapi: **Error 403: The client is not authorized to make this request., notAuthorized**