简体   繁体   English

从ec2中的sails到rds中的MySQL的连接给出握手不活动超时错误

[英]Connection from sails in ec2 to MySQL in rds giving handshake inactivity timeout error

I deployed my sails app in ec2 and I have mysql database in rds.我在ec2中部署了我的sails应用程序,我在rds中有mysql数据库。

when I use mysql in rds from my local, it worked absolutely fine.当我在本地的 rds 中使用 mysql 时,它工作得非常好。 But when I connect myswl in rds from the ec2 it is giving me this error:但是当我从 ec2 的 rds 中连接 myswl 时,它给了我这个错误:

error: A hook (`orm`) failed to load!
error: Error (E_UNKNOWN) :: Encountered an unexpected error
: Could not connect to MySQL:
Error: Handshake inactivity timeout

Please help me solve this issue.请帮我解决这个问题。 Should I configure my ec2 instance to connect to rds?我应该配置我的 ec2 实例以连接到 rds 吗?

When adding inbound connection in the security options, don't use anywhere.在安全选项中添加入站连接时,不要在任何地方使用。 As you can imagine, this is not secure at all.可以想象,这根本不安全。 Instead use the security group associated with your instance.而是使用与您的实例关联的安全组。 Of course, if you want to connect to your database remotely, add only your external IP address to the rules.当然,如果您想远程连接到您的数据库,只需将您的外部 IP 地址添加到规则中即可。 "Anywhere" is like an invitation to the whole world saying: "Try to hack me!" “任何地方”就像是对全世界的邀请说:“试着黑我!”

I figured it out.我想通了。 Added a inbound connection in security options with anywhere option.在带有任何地方选项的安全选项中添加了入站连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM