Reputation: 385
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
It is adding my local machine to the authorisation list. I can see that 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...
Connecting to database with SQL user [root].
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '{db ip}' (110)
It isn't configured to use SSL.
Upvotes: 1
Views: 4240
Reputation: 1524
Some thoughts:
A. User root might not be authorized on the database instance, period.
B. If user root is indeed authorized on 'dbinstance' from any host, there may be a firewall issue in play here on your local network.
gcloud beta sql connect dbinstance --user=root
If the password for root doesn't work, even in the Cloud Shell, try resetting the password (Users tab on your dbinstance Console page, three dots next to root
's entry, choose "Change Password."
If the password for root does work within the Cloud Shell environment, you've established that the issue lies between your local machine and the DB instance. Most often it's a firewall issue.
Upvotes: 2