0
votes

Hi (Sorry for my English)

I am a new user to Google Cloud SQL

I create a "Instance" and I have upload my database.

I request an Ip and also I have add on "Authorized Networks" all of my VPS ip's also I add my current IP from my ISP.

I try to connect from my VPS with

mysql_connect("Requested IP", "root", "PASSWORD")

but nothing happen and I receive this: Can't connect to MySQL server on 'XXX.XXX.XXX.XXX' (4)

Also I try to connect from my PC with mysql client like

mysql --host=Requested IP --user=root --password=PASSWORD

and I receive this: ERROR 2005 (HY000): Unknown MySQL server host

What wrong I have done ?

Thank you

1
Just to rule out network access issue - have you tried to ping the IP address?Tony Tseng
Yes I can ping the IP. But now when I try to connect from my PC with mysql client I receive this error: error 2013 (hy000) lost connection to mysql server at 'reading initial communication packet' server error 2user3271070
After many tries without change anything I can connect from my PC. Still can not connect from my VPS. Any idea what I have done wrong ?user3271070
I'm guessing it's the firewall setting - the public IP address of your VPS isn't set in the authorized network config. Can you verify that?Tony Tseng

1 Answers

0
votes

You should add your public IP as an Authorized Network in Cloud SQL.

Go to your instance configuration screen -> Access Control tab and on Authorized Networks add your public IP address.