Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud SQL - ERROR 2003 (HY000): Can't connect to MySQL

I am trying to connect my Google Cloud SQL using the command line.
I can successfully connect when at home and I set a static IP address. However, I have to be on the road the next few days and I can't be at home. I am hoping to connect to mysql and make changes as needed on the server through the hotspot on my phone, but I would be happy with any type of internet connection working. How can I connect to my Google Cloud SQL even though I keep getting error as,

ERROR 2003 (HY000): Can't connect to MySQL on server ...

  1. I tried creating a Google Compute Engine VM instance and setting a static IP address and connection to mysql through that, but it doesn't work.
  2. I make sure everytime to authorize the appropriate IP address, I am connecting from.

I am scratching my head and cannot figure out why it won't let me connect but at home even though I authorize all other IP address I have ever tried to connect from.

like image 986
Moustache_Me_A_Question Avatar asked Sep 28 '22 03:09

Moustache_Me_A_Question


People also ask

How do I fix MySQL error code 2003?

The error (2003) Can't connect to MySQL server on ' server ' (10061) indicates that the network connection has been refused. You should check that there is a MySQL server running, that it has network connections enabled, and that the network port you specified is the one configured on the server.

Does Google Cloud support MySQL?

You can use Cloud SQL, Google Cloud Marketplace, or manually install MySQL on Compute Engine. Cloud SQL offers MySQL as a web service. You can use Cloud SQL to host your MySQL database in Google's cloud, and let Google Cloud handle administrative duties like replication, patch management, and database management.


1 Answers

So for whatever reason, I was able to connect if I requested an IPv4 address (costs $0.01 an hour) and used that to connect instead of the free IPv6 address, then I could connect from anywhere. Otherwise I can only connect to my Cloud SQL when it is using the free IPv6 address at home. Check out the screen shot below to see which button to press on Cloud SQL Page > Access Control > IP addresses in order to request an IPv4 address and be able to connect with that IP address.

enter image description here

like image 78
Moustache_Me_A_Question Avatar answered Oct 02 '22 15:10

Moustache_Me_A_Question