mysql数据库实例不可用,为什么我不能直接连接到我的MySQL RDS数据库实例? (我只能通过SSH连接到EC2)...

当从个人计算机直接连接Amazon RDS失败,但通过EC2实例可以连接时,问题可能出在本地网络防火墙设置上。确保个人电脑的防火墙允许出站流量到用于连接数据库的端口(通常是3306)。可以使用PortQuiz工具检查网络是否允许该端口的通信。如果必要,尝试更改RDS实例使用的端口,因为RDS不支持更改已存在实例的端口。
摘要由CSDN通过智能技术生成

I made a MySQL RDS DB Instance, and I made sure the Instance is inside a security group which should allow me to connect to it externally. The security group allows all types of traffic from all IP addresses. The RDS is in the same security group as an EC2 I made.

I'm able to connect to the DB Instance by connecting to the EC2 via SSH, then using the mysql CLI client I installed on that EC2 to connect to the RDS. However, I'm not able to connect directly to the RDS from a MySQL client on my personal computer. I use the same host and username and all for the RDS, but circumventing the EC2 doesn't work.

From googling around, it seem like the error I'm getting is usually caused by the RDS's security group not allowing traffic from my computer - but this can't be the case, because I triple checked that the security group is open to all public traffic. Heck, the RDS is in the same security group as the EC2, and I'm able to connect to the EC2.

So what's going on?

解决方案

Check what outgoing ports are open in the firewall on the network your personal computer is on. Even though the the RDS Instance allows for all traffic, your firewall may be blocking you from making the connection. You can use http://portquiz.net/ to test whether your network allows for traffic on the port you're connecting to your DB with. With MySQL, the port is most likely 3306; if the port you're using with your DB isn't accessible via your network, find a port that works using the Port Quiz tool I just linked, and then remake your DB Instance using that port. (RDS doesn't let you change the port on an already existing Instance).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值