本文介绍了无法连接到AWS RDS上的mysql(错误2003)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在设置MySQL RDS时遇到麻烦.

I'm in trouble on setting up a MySQL RDS.

我可以从我的EC2 实例很好地连接,但是从我的笔记本电脑,我会收到错误2003(超时).

From my EC2 instance I can connect fine, but from my laptop I get error 2003 (timeout).

  • 我的RDS实例配置为可公开访问.
  • 我的安全组具有入站和出站规则,以允许所有流量到处(0.0.0.0/0).
  • My RDS instance is configured to be publicly accessible.
  • My security group has a rule inbound and outbound to allow all traffic everywhere (0.0.0.0/0).

我应该在VPC或Internet网关上配置某些内容吗?

Should I configure something on my VPC or Internet Gateway?

推荐答案

由于您的安全组已完全打开,我的猜测是您的LAN阻止了端口3306上的出站通信.实际上,请查看此支持页面( http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToInstance. html ),由于无法连接的常见原因,防火墙问题列为第二.

As your security groups are wide open, my guess is that your LAN is blocking outbound traffic on port 3306. Infact, looking at this support page ( http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToInstance.html ) firewall issues are listed as number 2 in common reasons for being unable to connect.

此问题可能会帮助您: MySql网络问题.可能值得一看您的本地防火墙设置.您提到您在笔记本电脑上,所以我猜您当前的网络被归类为公共网络,并且出站端口被阻止(如Ive链接的问题所述).

This question may help you out: MySql networking issue. May be worth taking a look at your local firewall settings. You mention you are on a laptop so my guess is your current network is classed as a public network and your outbound ports are being blocked (as mentioned in the question Ive linked).

如果这无济于事,则值得在端口3306上远程登录到RDS实例并查看会发生什么.这很可能为您提供更多调试信息,这些信息可以帮助解决有关该问题的一般信息.

If that gets you nowhere, its worth telnetting to your RDS instance on port 3306 and seeing what happens. This may well give you some more debug information which could help with the general Googling around of the issue.

顺便说一句,就我个人而言,我不会直接向Internet开放RDS实例.合理地直接设置ssh隧道,以通过SSH服务器将流量转发到您的RDS实例.类似于此处显示的内容: http://www.techrepublic.com/blog/linux-and-open-source/tips-and-tricks-to-help-you-do-more-with-openssh/

As an aside, personally I wouldn't open up an RDS instance to the Internet directly. Its reasonably straight forward to setup an ssh tunnel to forward traffic to your RDS instance through an SSH server. Something like the stuff shown here: http://www.techrepublic.com/blog/linux-and-open-source/tips-and-tricks-to-help-you-do-more-with-openssh/

更新:我从来没有将RDS与"publicable"选项一起使用(我们所有的设置都使用ssh隧道传输到私有RDS实例).在Google搜索中,我在Google论坛上遇到了很多与公共RDS实例的访问问题有关的查询.例如, https://forums.aws.amazon.com/thread.jspa? threadID = 123483 .可能值得尝试建议的解决方案,即在组成RDS实例的子网的路由表中显式创建条目?

UPDATE:I've never used RDS with the 'publicly available' option (all our setups used ssh tunnelling to private RDS instances). Googling around, I came across quite a few queries in the AWS forums relating to access issues to public RDS instances.For example, https://forums.aws.amazon.com/thread.jspa?threadID=123483.May be worth trying the suggested fix of explicitly creating entries in the route table for the subnets that compose the RDS instance?

这篇关于无法连接到AWS RDS上的mysql(错误2003)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 15:46