C#调用mysql.data.dll连接本地数据库时可以,但是在远程Linux服务器上连接mysql服务器时
报错Error log, current connection string
System.Security.Authentication.AuthenticationException: Authentication to host “xxx.xxx.xxx.xx”失败。
在 MySql.Data.Common.Ssl.StartSSL(Stream& baseStream, Encoding encoding, String connectionString)
在 MySql.Data.MySqlClient.NativeDriver.Open()
在 MySql.Data.MySqlClient.Driver.Open()
在 MySql.Data.MySqlClient .Driver.Create(MySqlConnectionStringBuilder 设置)
在 MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
在 MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
在 MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
在 MySql.Data.MySqlClient.MySqlPool.GetConnection()
在 MySql.Data.MySqlClient.MySqlConnection.Open()
<add key="dbString" value="server=localhost;port=3306;user=root;password=root; database=id3net" />
如果主机不支持 SSL 连接,则不会使用 SSL 连接
解决方案:在连接字符串后添加 sslmode = none。
<add key="dbString" value="server=localhost;port=3306;user=root;password=root; database=id3net;SslMode=none" />
在C#应用中使用mysql.data.dll尝试通过连接字符串连接到远程Linux上的MySQL服务器时遇到AuthenticationException错误。问题在于服务器不支持SSL连接。解决方法是在连接字符串中添加`sslmode=none`,禁止SSL连接。例如:`server=localhost;port=3306;user=root;password=root;database=id3net;SslMode=none`。
7735

被折叠的 条评论
为什么被折叠?



