Search code examples
google-cloud-sqlgcloud

Unable to connect gcloud sql instance


I have create a cloud sql instance as shown below -

Cloud SQL instance settings.

I have also allowed all network (0.0.0.0/0) under authorised network. But when I try to connect it using gcloud sql connect <ip address> -u <username> I get this error -

ERROR: (gcloud.sql.connect) HTTPError 400: Invalid request: instance name (34.69.175.233).

When I run the same command like this gcloud sql connect <ip address> -u <username> --log-http for the log I get this -

{
  "error": {
    "code": 400,
    "message": "Invalid request: instance name (34.69.175.233).",
    "errors": [
      {
        "message": "Invalid request: instance name (34.69.175.233).",
        "domain": "global",
        "reason": "invalid"
      }
    ]
  }
}

I am not able to identify what exactly is the problem.


Solution

  • Note that, gcloud sql connect command is not supported for Cloud SQL Server at this time and you may instead connect via a local client, or the proxy. I have send a feedback to the Cloud SQL Documentation team to clarify that this command is not applicable for Cloud SQL Server in the gcloud documentation until the gcloud command gets implemented.