N S
N S

Reputation: 2603

Google Cloud SQL Authorized Network can't connect

I'm trying to connect to my Google Cloud SQL instance from my desktop but am getting the following error:

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

According to the docs this means that the client's IP isn't authorised to access the instance. I have done the standard "what's my ip" google search and added the IP to the "Authorised Networks" list of the instance (as well as a bunch of variations and /x ranges - none have worked, yes I restarted the instance). I have set a root password and even tried connecting with the necessary SSL certs - yields the same error.

I can connect to other (non-google) sql databases, I can ping the database, and I'm not behind any significant firewalls. How i'm typically trying to connect (also tried SSL):

mysql --host=the.instance.ip.add --user=root --password

Nothing I try seems to work.

I feel like I must be missing something obvious - any suggestions welcome (this is a nightmare).

Upvotes: 2

Views: 2851

Answers (3)

Julio Ayala
Julio Ayala

Reputation: 73

Make sure that the IP you are using is the public IP, keep in mind that this can change from time to time depending on your Internet provider. The easiest way to authorize any network is to add 0.0.0.0/0 to the witelist

I check my ip addres in this page https://www.whatismyip.com/es/

Upvotes: 0

Razvan Musaloiu-E.
Razvan Musaloiu-E.

Reputation: 1320

The "what's my ip" search on Google doesn't currently work properly when the ISP is proxying the web traffic transparently. Better information on the IP seems to be provided by Proxy Test from http://www.lagado.com/proxy-test.

Upvotes: 0

Aditya Mone
Aditya Mone

Reputation: 226

Could you check again if you have authorized the correct IP address. If using your desktop from home, you may be having a private IP address for the desktop. What you really need to authorize is the public IP address.

Upvotes: 0

Related Questions