Mysql – how to connect to thesql database from visual studio without requiring SSL connection

mysql-5.7

I have established a link between Mysql database and visual studio on my windows 10 machine.Unfortunately my application which is a desktop app can't open a connection to the DB. I keep getting this error whenever I try connecting to the database:
MySql.Data.MySqlClient.MySqlException: 'The host localhost does not support SSL connections.'

This is my connection:

***MySqlConnection conn = new MySqlConnection("user id=root;server=localhost;persistsecurityinfo=True;database=edutechsys");
MySqlCommand cmd = new MySqlCommand("SELECT * FROM TblLogin WHERE UserName = '" + TxtUserName.Text.Trim() + "' and Password = '" + TxtPassword.Text.Trim() + "'");
conn.Open();
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
MySqlDataAdapter da = new MySqlDataAdapter();
**

How do I correct the error.

Best Answer

You might want to explicitly add this to the connection string - "SslMode=none" Your connection should look like this:

MySqlConnection conn = new MySqlConnection("user id=root;server=localhost;persistsecurityinfo=True;database=edutechsys"); SslMode=none; MySqlCommand cmd = new MySqlCommand("SELECT * FROM TblLogin WHERE UserName = '" + TxtUserName.Text.Trim() + "' and Password = '" + TxtPassword.Text.Trim() + "'"); conn.Open(); cmd.ExecuteNonQuery(); DataTable dt = new DataTable(); MySqlDataAdapter da = new MySqlDataAdapter();