简体   繁体   English

谷歌云 SQL Docker 代理

[英]Google Cloud SQL Docker Proxy

I am trying to connect to my Cloud SLQ (Postgres) instance from my local environment (OSX) using the Google Cloud SQL Docker Proxy as documented here .我正在尝试使用此处记录的 Google Cloud SQL Docker 代理从我的本地环境 (OSX) 连接到我的 Cloud SLQ (Postgres) 实例。 When running the proxy I get:运行代理时,我得到:

google: could not find default credentials.

Note that I am running gcloud on my local environment within the right project and having authenticated through the application-default login.请注意,我在正确项目中的本地环境中运行 gcloud,并通过application-default登录进行了身份验证。 I understand that in similar questions this is what solved the issue however this is not my case.我知道在类似的问题中,这就是解决问题的方法,但这不是我的情况。

Specifying the absolute path of the key file solved my problem.指定密钥文件的绝对路径解决了我的问题。

Here is a good resource for this issue: https://cloud.google.com/sql/docs/mysql/connect-admin-proxy这是解决此问题的好资源: https://cloud.google.com/sql/docs/mysql/connect-admin-proxy

Look at where you specify PATH_TO_KEY_FILE here:查看您在此处指定 PATH_TO_KEY_FILE 的位置:

   docker run -d \
      -v PATH_TO_KEY_FILE:/config \
      -p 127.0.0.1:3306:3306 \
      gcr.io/cloudsql-docker/gce-proxy:1.19.1 /cloud_sql_proxy \
      -instances=INSTANCE_CONNECTION_NAME=tcp:0.0.0.0:3306 \
      -credential_file=/config

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM