简体   繁体   English

连接到RDS上的MySQL数据库

[英]Connecting to MySQL DB on RDS

I've recently encountered a phenomenon that absolutely baffled me. 我最近遇到了一种让我感到困惑的现象。 So far, I've been connecting without any problem to an Amazon RDS instance running MySQL. 到目前为止,我一直在毫无问题地连接到运行MySQL的Amazon RDS实例。 Right now, I'm trying to migrate to DB in the free tier - running on Microsoft Express Edition. 现在,我正在尝试迁移到免费层-在Microsoft Express Edition上运行的数据库。

I've properly set up the security of the instance and can connect to it through SQL Explorer in Visual Studio 2012. However, I can't access it through Python (MySQLdb - same credentials, and same script that worked with first db): 我已经正确设置了实例的安全性,并且可以通过Visual Studio 2012中的SQL Explorer连接到它。但是,我无法通过Python(MySQLdb-相同的凭据,以及与第一个数据库一起使用的脚本)访问它:

2013, Lost connection to MYSQL server at 'reading initial communication packet', system error 104 2013,在“读取初始通信数据包”时失去与MYSQL服务器的连接,系统错误104

Nor through MySQL-Front - connection failure. 也不通过MySQL-Front连接失败。

I can't wrap my head around it - am I missing something obvious? 我无法绕开它-我是否缺少明显的东西? Exactly the same thing happens on two machines - VS can connect, while nothing else can. 完全相同的事情在两台计算机上发生-VS可以连接,而其他则不能。 Ideas? 想法?

Python connection attempt: Python连接尝试:

db = MySQLdb.connect(host = "yep-my-endpoint.us-west-2.rds.amazonaws.com",
                     user="user",passwd="mypasswd", port=1433, db="yep-db-name")

Is there maybe some setting that I have to set in connection for it to work? 是否可能需要设置一些设置才能使其正常工作? I failed to find anything related. 我找不到任何相关的东西。

Have you checked your Amazon RDS Security Groups? 您是否检查了Amazon RDS安全组? Please note that in some cases, you'll need to add the IP address from which you're connecting. 请注意,在某些情况下,您需要添加连接的IP地址。 In that case, select a Security Group from the left menu, edit it and add the CIDR/IP. 在这种情况下,请从左侧菜单中选择一个安全组,对其进行编辑并添加CIDR / IP。

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

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