I can list the databases in my Cloud SQL instance but I can't connect to it.
gcloud beta sql databases list --instance=dbinstance
NAME CHARSET COLLATION
information_schema utf8 utf8_general_ci
main utf8 utf8_general_ci
mysql utf8 utf8_general_ci
performance_schema utf8 utf8_general_ci
I can see my local machine being added to the authorisation list via the console. But it's failing to connect:
gcloud beta sql connect dbinstance --user=root
Whitelisting your IP for incoming connection for 5 minutes...done.
Connecting to database with SQL user [root].
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on 'x.x.x.x' (110)
It isn't configured to use SSL. Actually, this is a newly created instance so I'm happy to try any suggestions regardless of how drastic they are. I can connect in this way from the gcloud command line within the console.
Hello Stephen,
Since you are able to connect through cloudshell using the same gcloud commands, I suspect it is an issue within your local machine. Generally, when this error is logged, it means that the Cloud SQL instance did not whitelist (authorize) your IP, but could also be an underlying networking issue. In your message, you mentioned that you can see an IP address being authorized. It could be that your true IP address is different (computer behind proxy). You may find your IP through following both scenarios in this document . Then, to isolate the issue you may try the following:
Manually add your computer’s IP address in the authorization list.
use this command (gcloud uses the same client mysql command on your machine after the automatic whitelisting):
mysql -h <yourCloudSQLIP> -u root -p
More troubleshooting steps can be found here [1] [2].You may also check these very similar issues at stackoverflow here [3] [4] . Furthermore,you may try other methods to connect using this guide. I hope this helps.