简体   繁体   English

AWS RDS MySql:从本地工作台连接

[英]AWS RDS MySql: connect from local Workbench

I am very much confused right now, since a connection from my local MySQL workbench to an instance in AWS RDS does not work anymore.我现在非常困惑,因为从本地 MySQL 工作台到 AWS RDS 中的实例的连接不再起作用。 I have a dynamic IP, so I edited the inbound rules in the AWS security group to reflect that, but I am still getting error: "MySQL Error 2003 (HY000): Can't connect to MySQL server on 'xyz.us-east-1.rds.amazonaws.com' (10060)"我有一个动态 IP,所以我编辑了 AWS 安全组中的入站规则以反映这一点,但我仍然收到错误:“MySQL 错误 2003 (HY000): Can't connect to MySQL server on 'xyz.us-east -1.rds.amazonaws.com' (10060)"

I also tried to establish a connection via Command Prompt but same result there.我也尝试通过命令提示符建立连接,但结果相同。 What I want to try next is using MySQL shell, but I am not sure how to change the user in the connect statement.我接下来要尝试的是使用 MySQL shell,但我不确定如何在连接语句中更改用户。 Entering进入

\connect --mysql xzy.us-east-1.rds.amazonaws.com

returns a prompt, asking me to provide the password for 'myWindowsUser@xyz.us-east-1.rds.amazonaws.com'.返回提示,要求我提供“myWindowsUser@xyz.us-east-1.rds.amazonaws.com”的密码。 However, I obviously do not want to connect with my Windows User but the admin of the DB instance.但是,我显然不想与我的 Windows 用户连接,而是与数据库实例的管理员连接。 How can I change the user?如何更改用户? Typing -u admin -p results in输入 -u admin -p 结果在此处输入图像描述

Thanks a lot for any hint!非常感谢任何提示!

edit: I am also admin of the AWS RDS instance, so I can see it is up & running编辑:我也是 AWS RDS 实例的管理员,所以我可以看到它正在运行

edit1: here is the reply I get for nslookup: edit1:这是我收到的 nslookup 回复: 在此处输入图像描述 as well as a picture of the security group:以及安全组的图片: 在此处输入图像描述

BTW, answer is it's not best practice to connect your aws RDS instance from local means from outside the aws account.顺便说一句,答案是从 aws 帐户外部通过本地方式连接您的 aws RDS 实例不是最佳做法。 It must be in private VPC.它必须在私有 VPC 中。

However, still if you need use this.但是,如果您需要使用它。

Pass the -u with username using command line the below one:使用以下命令行传递 -u 和用户名:

mysql -u {username} -p'{password}' \
    -h {remote server ip or name} -P {port} \
    -D {DB name}

\connect --mysql -u admin xzy.us-east-1.rds.amazonaws.com

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

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