系统启动时通过.net连接器连接mysql时出错

本文关键字:连接 mysql 出错 连接器 net 系统启动 | 更新日期: 2023-09-27 18:19:29

我收到以下错误

MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts. ---> System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 111.22.3.44:3306
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at MySql.Data.Common.MyNetworkStream.CreateSocketStream(MySqlConnectionStringBuilder settings, IPAddress ip, Boolean unix)
   at MySql.Data.Common.MyNetworkStream.CreateStream(MySqlConnectionStringBuilder settings, Boolean unix)
   at MySql.Data.Common.StreamCreator.GetTcpStream(MySqlConnectionStringBuilder settings)
   at MySql.Data.MySqlClient.NativeDriver.Open()
   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()
   at CC.DataAccess.ConnectionManager.GetConnection()

我的数据库服务器在Centos上,版本为5.6.25我使用的是.net 4.5和mysqlconnecot 6.9.7。有其他人面临这个问题吗

系统启动时通过.net连接器连接mysql时出错

你的代码兄弟在哪里?你能把你的样本代码粘贴在这里吗?

你可能会从得到一些提示

无法从ASP.NET 连接到MySQL数据库

无法连接到任何指定的mysql主机。C#MySQL