c# – How to connect to a MySQL Database without SSL

c# – How to connect to a MySQL Database without SSL

Have you tried to set the SslMode property to none in 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;)
using MySql.Data.MySqlClient;

private const String SERVER = 1.1.1.1;         // Server IP
private const String DATABASE = abc;           // Date base name
private const String TABLE = test;             // Table name
private const String UID = user;               // Date base username
private const String PASSWORD = pass;          // Date base password

public static void InitializeDataBase()
{                
MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder();

builder.Server = SERVER;
builder.UserID = UID;
builder.Password = PASSWORD;
builder.Database = DATABASE;
builder.SslMode = MySqlSslMode.None;
//builder.CertificateFile = @<Path_To_The_File>client.pfx;
//builder.CertificatePassword = <Password_For_The_Cert>;

String connString = builder.ToString();
builder = null;

dbConn = new MySqlConnection(connString);         
}    

c# – How to connect to a MySQL Database without SSL

Leave a Reply

Your email address will not be published. Required fields are marked *