本地获取cloud_sql_proxy的notAuthorized错误 [英] Getting notAuthorized error with cloud_sql_proxy locally

查看:91
本文介绍了本地获取cloud_sql_proxy的notAuthorized错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为第二代云SQL实例在本地设置连接.

I'm trying to setup a connection locally for 2nd generation cloud sql instance.

呼叫代理人是

./cloud_sql_proxy -dir=/cloudsql -instances=status-1268:us-central1:status-dev=tcp:3306 & mysql -u status_stg --host 127.0.0.1

对于在API部分中如何正确设置服务帐户,我有点不清楚,因此我尝试使用两个默认值(App引擎默认服务帐户和Compute引擎默认服务帐户).我还创建了一个新的单一服务帐户.我为每个用户在管理权限"部分中将服务帐户ID分配为编辑者"和所有者".也许还有另一种方法可以为这些帐户启用Cloud SQL Admin API?

I am a bit unclear on how to set up correctly the service accounts from the API section, so I tried with both of the defaults, App engine default service account and Compute engine default service account. I also created a new one service account. For each one of them I assigned the service account ID to be Editor and Owner from the manage permissions section. Perhaps there is another way to enable Cloud SQL Admin API for these accounts?

当我的服务尝试与数据库对话时,代理的输出:

Output from proxy when my service tries to talk to DB:

./cloud_sql_proxy -dir=/cloudsql -instances=status-1268:us-central1:status-   dev=tcp:3306 & mysql -u status_stg --host 127.0.0.1
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (61)
2016/04/04 11:26:58 Open socket for "status-1268:us-central1:status-dev" at     "127.0.0.1:3306"
2016/04/04 11:26:58 Socket prefix: /cloudsql
2016/04/04 11:27:10 Got a connection for "status-1268:us-central1:status-dev"
2016/04/04 11:27:11 couldn't connect to "status-1268:us-central1:status-dev": googleapi: Error 403: The client is not authorized to make this request., notAuthorized
2016/04/04 11:29:08 Got a connection for "status-1268:us-central1:status-dev"
2016/04/04 11:29:08 couldn't connect to "status-1268:us-central1:status-dev": googleapi: Error 403: The client is not authorized to make this request., notAuthorized

关于寻找什么的想法?我想我在这里缺少一些配置服务帐户的基本知识.

Thoughts on what to look for? I think I am missing something basic here configuring the service accounts.

(总的来说,对于我的项目,我正在运行一个node.js express应用程序,希望将其连接到第二个gend cloud sql数据库实例,而不必像我目前正在使用的那样使用0.0.0.0公开它)

(Overall, for my project I am running a node.js express app and hoping to connect it to 2nd gend cloud sql DB instance without having to expose it with 0.0.0.0 as I currently have working)

谢谢

推荐答案

请仔细检查连接字符串.听起来您的凭据顺序正确,所以您的实例名称可能有误.

Please double check the connection string. It sounds like your credentials are in order, so it's likely you have an error in the instance name.

我建议复制&从实例的Cloud Console页面粘贴实例连接名称":

I recommend copying & pasting the "Instance connection name" from the Cloud Console page for the instance:

这篇关于本地获取cloud_sql_proxy的notAuthorized错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆