首页 文章

无法使用Cloud SQL Proxy从Google Compute Engine连接到Google Cloud SQL

提问于
浏览
0

我正在尝试使用Cloud SQL Proxy将GCE实例连接到Cloud SQL实例(第2代) . 当我ssh到GCE实例和

sudo ./cloud_sql_proxy -dir=/cloudsql

我明白了

2016/07/13 18:59:28 Using gcloud's active project: xxxx-0000
2016/07/13 18:59:29 Error listing instances in xxxx-0000:
    googleapi: Error 403: Access Not Configured.
    Cloud SQL Administration API has not been used in project 000000000000
    before or it is disabled. Enable it by visiting
    https://console.developers.google.com/apis/api/sqladmin/overview?project=000000000000
    then retry.
    If you enabled this API recently, wait a few minutes for the action to
    propagate to our systems and retry., accessNotConfigured
2016/07/13 18:59:29 no Cloud SQL Instances found in these projects: [xxxx-0000]

我已经跟踪了文件
https://cloud.google.com/sql/docs/compute-engine-access#gce-connect-proxy
https://cloud.google.com/sql/docs/sql-proxy

这两个实例都在同一个项目中,并且在GCE实例上启用了Cloud SQL API(加上默认实例) . 据我了解,默认的GCE服务帐户应该能够对代理进行身份验证 .

在尝试连接时,使用 cloud_sql_proxy-instances 似乎也可以正常工作 accessNotConfigured .

2 回答

  • 0

    根据错误消息,您需要通过访问提供的链接确保启用“Cloud SQL Admin”API .

  • 1

    有's also a GUI way to connect your Compute Engine instance if you'使用第二代GCloud SQL实例 . 首先获取计算引擎的外部IP,并将其包含在GCloud SQL仪表板的“授权”选项卡中 . 这是一个快速video

相关问题