无法使用 MySQL workbench 连接到 Amazon RDS

Can't connect to Amazon RDS with MySQL workbench

我正在尝试使用 MySQL workbench 连接到 Amazon RDS,但我一直 运行 进入此错误:

Your connection attempt failed for user 'admin' from your host to server at database-2.cv15axugkvps.us-east-2.rds.amazonaws.com:3306:
Can't connect to MySQL server on 'database-2.cv15axugkvps.us-east-2.rds.amazonaws.com' (60)

Please: 1 Check that MySQL is running on the server database-2.cv15axugkvps.us-east-2.rds.amazonaws.com

2 Check that MySQL is running on port 3306 (note: 3306 is the default, but this can be changed)

3 Check the admin has rights to connect to database-2.cv15axugkvps.us-east-2.rds.amazonaws.com from your address (MySQL rights define what clients can connect to the server and from which machines)

4 Make sure you are both providing a password if needed and using the correct password for database-2.cv15axugkvps.us-east-2.rds.amazonaws.com connecting from the host address you're connecting from

我知道我的主机名、端口、用户名和密码都是正确的。我什至用新的用户名和密码创建了第二个数据库,以确保我没有忘记原件。

看起来像这个人had a similar problem。他们评论道:

Okay, I take the blame for this one. I thought port 3306 was open for everywhere, but I had to assign it my IP address to allow traffic.I had to get my IP address (www.whatsmyip.org) and then add that as a 3306 port in my security group. If your IP is 12.34.56.78, choose "MySQL" from the "Create a New Rule" dropdown menu in you Security Group's "Inbound" tab. Then add 12.34.56.78/32 as the Source, click "Add Rule" then click "Apply Rule Changes"

我试过了,但遇到了同样的问题。

根据评论,问题是数据库实例是 private。将其更改为 public 解决了问题。