0
votes

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.

2
You should be able to connect directly to that instance (on that IP) using a regular MySQL client. gcloud sql connect ... requires the instance name (not IP) and uses the SQL proxy to connect to the instance. - DazWilkin
not able to connect after using instance name via cloud shell - Jeet Patel
Aha! Hmmm :-( Let me repro and I'll report back - DazWilkin
I see you're using SQL Server (not MySQL|Postgres) so my previous suggestion to use a MySQL client is incorrect but, I'm reviewing the SQL Server docs. - DazWilkin
I think you cannot use gcloud sql connect with SQL Server - DazWilkin

2 Answers

1
votes

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.

0
votes

you can try with "cloud_sql_proxy -instances=[connection-name]=tcp:0.0.0.0:[port]"