异常: “主机本地主机不支持 SSL 连接。”

我使用 MySql.Data8.08和.NET Core 连接到 MySql5.7.18 但引发了以下异常:

MySql.Data.MySqlClient.MySqlException:“The host localhost does not support SSL connections.”

怎么处理?

85726 次浏览

I had the same problem today when moving from MySql.Data 7.0.7 to 8.0.8. I was able to move forward adding the "SslMode=none" in the connection string.

You will endup with something like:

server={0};user id={1};password={2};persistsecurityinfo=True;port={3};database={4};SslMode=none

(replacing the values with your database details)

And if you using a connection pool class, then you might have to do this way:

    string connstring = string.Format("Server=44.55.110.59; database={0}; UID=root; password=Newuser@123; SslMode = none", databaseName);