无法使用Cloud SQL代理连接到数据库

时间:2018-02-24 23:28:32

标签: kubernetes google-cloud-platform google-cloud-sql

使用GCloud CLI创建服务帐户和密钥时,我收到以下错误

2018/02/24 22:32:35 New connection for "moodle-proj-10:europe-west2:mysqlinst10"
2018/02/24 22:32:35 couldn't connect to "moodle-proj-10:europe-west2:mysqlinst10": ensure that the account has access to "moodle-proj-10:europe-west2:mysqlinst10" (and make sure there's no typo in that name). Error during createEphemeral for moodle-proj-10:europe-west2:mysqlinst10: googleapi: Error 403: The client is not authorized to make this request., notAuthorized

当我删除服务帐户并使用控制台重新创建相应的密钥时,错误会更改为以下错误

2018/02/24 23:21:25 couldn't connect to "moodle-proj-10:europe-west2:mysqlinst10": Post https://www.googleapis.com/sql/v1beta4/projects/moodle-proj-10/instances/mysqlinst10/createEphemeral?alt=json: oauth2: cannot fetch token: 400 Bad Request
Response: {
  "error" : "invalid_grant",
  "error_description" : "Invalid JWT Signature."
}

有没有人经历过这个?

1 个答案:

答案 0 :(得分:0)

我遵循此help article

中的命令行说明时遇到了这个问题

解决方案是使用this help article在控制台中删除原始服务帐户并创建一个新帐户。