Google Cloud SQL 导入 - 错误:HTTPError 403:客户端无权发出此请求

Beg*_*ner 6 google-cloud-storage google-cloud-sql google-cloud-platform

我尝试使用以下命令导入存储在 Cloud Storage 中的数据库:

gcloud sql instances import instance-name gs://connect-to-the-cloud-sql.appspot.com/my-cloud-sql-instance-backup
Run Code Online (Sandbox Code Playgroud)

但是,我收到错误:

ERROR: (gcloud.sql.instances.import) HTTPError 403: The client is not authorized to make this request.
Run Code Online (Sandbox Code Playgroud)

我已经登录使用:

gcloud auth login
Run Code Online (Sandbox Code Playgroud)

小智 7

确保实例名称正确。我有同样的错误,只要我更正了实例名称,它就消失了。

  • 在我的情况下,我一直在尝试使用`--instance=project:zone:instance-name`命令`gcloud sql users list`,并在我尝试`--instance=instance-name`时出现同样的错误有效 (3认同)

kip*_*ip2 5

我遇到了这个问题,我的实例名称是正确的。原来我在错误的 GCP 项目中。确保切换到正确的 [target] 项目或使用 project 参数:

gcloud sql instances export my-cloud-sql-instance gs://connect-to-the-cloud-sql.appspot.com/my-cloud-sql-instance-backup --project=<your target project>
Run Code Online (Sandbox Code Playgroud)