Cloud SQL Proxy error - An attempt was made to access a socket in a way forbidden by its access permissions

Viewed 10220

This is the error that comes up when I try to use Cloud SQL Proxy to configure access to Google Cloud SQL in windows - "listen tcp 127.0.0.1:3306: bind: An attempt was made to access a socket in a way forbidden by its access permissions."

This is the format of the command I'm using "cloud_sql_proxy.exe -dir=/cloudsql -instances=my-project:us-central1:sql-instance=tcp:3306 mysql -u --host " - as is described in the docs.

Can someone please let me know what's actually causing this ?

5 Answers

I my case I was using docker image with the same port installed in my local machine so the local mysql is not allowing to access the port because is already been used and running. I Uninstall local mysql .now its working fine

you need a token to sql cloud you van generate the token here google service token generator and then take the token it will generate and put it here while INSTANCE_CONNECTION_NAME is can be taken from the the sql instanse overview page in google cloud console

cloud_sql_proxy -token=ACCESS_TOKEN
-instances=INSTANCE_CONNECTION_NAME=tcp:PORT_NUMBER

see in docs for more details sql proxy auth more way to connect

to me it solve the 400 bad request problem

Response: {
 "error": "invalid_grant",
  "error_description": "Bad Request"
}

pay attention - if you use this way to connect you must allow unsafe connecteion in the sql instanse config page

Related