b0云SQL -错误2003 (HY000):无法连接到MySQL

时间:2022-09-19 22:35:26

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,

我尝试使用命令行连接谷歌云SQL。我可以在家里成功连接,并设置一个静态IP地址。然而,接下来的几天我必须上路,我不能呆在家里。我希望通过我手机上的热点连接到mysql,并根据需要在服务器上进行更改,但是我希望任何类型的internet连接都能正常工作。我如何连接到我的谷歌云SQL即使我不断得到错误,

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

错误2003 (HY000):服务器无法连接到MySQL…

  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. 我尝试创建一个谷歌计算引擎VM实例并设置一个静态IP地址,并通过它连接到mysql,但它不起作用。
  3. I make sure everytime to authorize the appropriate IP address, I am connecting from.
  4. 我确保每次授权合适的IP地址时,我正在连接。

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.

我在挠头,搞不清为什么它不让我连接,但在家里,即使我授权所有其他IP地址,我曾试图连接。

1 个解决方案

#1


3  

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.

因此,不管出于什么原因,如果我请求一个IPv4地址(每小时0.01美元)并使用它来连接而不是免费的IPv6地址,那么我可以连接任何地方。否则,在家里使用免费的IPv6地址时,我只能连接到我的云SQL。查看下面的屏幕截图,查看在Cloud SQL页面>访问控制> IP地址上按哪个按钮,以便请求IPv4地址并能够连接该IP地址。

b0云SQL -错误2003 (HY000):无法连接到MySQL

#1


3  

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.

因此,不管出于什么原因,如果我请求一个IPv4地址(每小时0.01美元)并使用它来连接而不是免费的IPv6地址,那么我可以连接任何地方。否则,在家里使用免费的IPv6地址时,我只能连接到我的云SQL。查看下面的屏幕截图,查看在Cloud SQL页面>访问控制> IP地址上按哪个按钮,以便请求IPv4地址并能够连接该IP地址。

b0云SQL -错误2003 (HY000):无法连接到MySQL