0
votes

I'm trying to connect to Google Cloud SQL from my machine (Ubuntu) using this command:

mysql --host='Public IP' --user='' --password

However, I'm getting this error:

ERROR 2003 (HY000): Can't connect to MySQL server on 'Public IP' (110)

I need any help resolving my issue.

3

3 Answers

0
votes

First you need to let the Cloud SQL instance which IP addresses it can accept. You can do that without SSL by following the instructions here. However, to be more secure, I would recommend you using SSL. More info on that here.

0
votes

Probably the easiest way to securely connect from your local machine to a public ip of a cloud SQL instance is to download and use the proxy, following the instructions here:

https://cloud.google.com/sql/docs/mysql/connect-admin-proxy

0
votes

What you have to do is add a network to the public ip section, under the connections tab after selecting your Cloud SQL instance.

See Cloud SQL Connections Tab here

So, for the name input you put firstname-lastname kind of thing to denote whose ip it is. Then input your IP address 1.2.3.4/32 into the network input.

After doing so and saving you will be able to connect.

Yes, you can add SSL and use certificates. That is all best practice and what should be done for a production stack. But if this is just getting off the ground and in rapid development, that's all you need to do in the beginning.