google-cloud-platform - Google Cloud SQL 连接错误 - 403 : Access Not Configured - despite having enabled the API

标签 google-cloud-platform google-cloud-sql

我正在尝试通过 MySQL 客户端连接到 Google Cloud SQL 实例,这需要我通过 Google Cloud 代理进行连接。我已按照 Google Cloud Docs 上的所有说明进行操作,但在运行命令启动代理后(使用正确的 INSTANCE_CONNECTION_NAMEPATH_TO_KEY_FILE),我收到以下 error .

命令 :

./cloud_sql_proxy -dir=/cloudsql -instances=INSTANCE_CONNECTION_NAME \ -         credential_file=PATH_TO_KEY_FILE &

错误 :

couldn't connect to "INSTANCE_CONNECTION_NAME": ensure that the account has access to "INSTANCE_CONNECTION_NAME" (and make sure there's no typo in that name). Error during createEphemeral for INSTANCE_CONNECTION_NAME: googleapi: Error 403: Access Not Configured. Cloud SQL Administration API has not been used in project 563584335869 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/sqladmin.googleapis.com/overview?project=563584335869 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry., accessNotConfigured



我已经确认在项目的控制台上启用了 Google Cloud SQL API,但奇怪的是我的项目名称不是 563584335869,而且我已经通过 GC CLI 设置了正确的项目名称,但无济于事。所以访问时https://console.developers.google.com/apis/api/sqladmin.googleapis.com/overview?project=563584335869 , 我懂了:

The API "sqladmin.googleapis.com" doesn't exist or you don't have permission to access it



我还在角色 Cloud SQL Client 下创建了一个服务帐户,并下载了 PATH_TO_KEY_FILE 指向的私钥。

最佳答案

您能否确认您启用了“Cloud SQL API”(sqladmin.googleapis.com)而不是“Cloud SQL”API? (sql-component.googleapis.com)?

您能否提供更多有关您的环境的信息?您是在本地机器上运行它还是在 Cloud Shell 中工作?

关于google-cloud-platform - Google Cloud SQL 连接错误 - 403 : Access Not Configured - despite having enabled the API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51235151/

相关文章:

google-cloud-platform - 如果我分配 Cloud Function 256MB,它的每个函数实例是否都可以访问 256MB?

Spring Boot + Spring Data on GAE with CloudSql - 数据库连接

kubernetes - Kubernetes Pod集群IP没有响应?

sql - 在启动时运行 MS SQL 服务器脚本

php - 在 Google App Engine 上运行 Wordpress 时出现数据库错误

mysql - Google Cloud SQL 读取平台内其他区域的副本

python - 在 Windows 64 位上安装 Cloud SQL 代理时出现问题

google-cloud-platform - 在 ml-engine 上部署模型,使用 tf.train.Saver() 导出

google-cloud-platform - 服务帐户即使具有 'owner' 权限也会抛出权限不足错误

node.js - Google App Engine - 具有所有语言环境的 Node.js