我无法从EC2连接到MySQL,而我可以从localhost连接到MySQL

时间:2017-12-07 12:38:29

标签: asp.net amazon-web-services

我正在使用ASP.NET开发应用程序的后端,当我在Visual Studio中并使用来自Amazon的MySQL测试端点时,它工作正常。但是,当我在EC2实例上传代码并尝试测试相同的端点时,我收到了错误。

{
    "Message":"An error has occurred.",
    "ExceptionMessage": "Unable to connect to any of the specified MySQL hosts.",
    "ExceptionType":"MySql.Data.MySqlClient.MySqlException",
    "StackTrace":" at MySql.Data.MySqlClient.NativeDriver.Open() 
        at MySql.Data.MySqlClient.Driver.Open() at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) 
        at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
        at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() 
        at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
        at MySql.Data.MySqlClient.MySqlPool.GetConnection() 
        at MySql.Data.MySqlClient.MySqlConnection.Open()
}

MySQL是一个RDS,并且有一个安全组连接到EC2,允许端口3306

为什么会发生这种情况?

0 个答案:

没有答案