Net Core教程

c# 连接MySQL 提示SSL Connection error

本文主要是介绍c# 连接MySQL 提示SSL Connection error,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

c# 连接MySQL 提示SSL Connection error
Mysql.Connection调用Open()时报错,try catch得到如下错误信息:
2021-10-18 14:40:23,388 [1] ERROR *** - SSL Connection error.
2021-10-18 14:40:23,390 [1] ERROR *** - at MySql.Data.Common.Ssl.StartSSL(Stream& baseStream, Encoding encoding, String connectionString)
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()

解决办法:在连接字符串后面加上 SslMode=None
如下 server=127.0.0.1;port=3306;user id=root;password=zaq;database=yehe;CharSet=utf8mb4;Allow Zero Datetime=true;SslMode=None

Ref:
https://www.cnblogs.com/simadi/p/15235552.html

这篇关于c# 连接MySQL 提示SSL Connection error的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!