I'm trying to connect to a local MySQL DB.
I have this connector:
using(MySqlConnection conn = new MySqlConnection("Database=Studentenverwaltung;Port=3306;Data Source=127.0.0.1;User Id=root;Password=abc123"))
{
try
{
conn.Open();
Console.WriteLine("Opened!");
conn.Close();
}
catch(Exception e)
{
Console.WriteLine("Cannot open Connection");
Console.WriteLine(e.ToString());
}
}
But I get this Exception:
MySql.Data.MySqlClient.MySqlException (0x80004005): The host 127.0.0.1 does not support SSL connections.
It seems that it cannot connect to the DB because the DB doesn't support SSL. So is there a way how to connect to the DB whithout SSL?
解决方案
Have you tried to add the SslMode property to your connection string?
This should work:
new MySqlConnection("Database=Studentenverwaltung;Port=3306;Data Source=127.0.0.1;User Id=root;Password=abc123;SslMode=none;")
本文介绍了一种在尝试连接本地MySQL数据库时遇到的SSL连接问题及其解决方案。通过修改连接字符串中的SslMode属性为none,可以成功绕过SSL验证,实现数据库的正常连接。

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



