So I've been using the MySql.Data from NuGet for a long time for connecting with my MariaDB databases in a lot of different .NET projects. It happens that now I'm starting a new .NET5 project and to start fresh just installed the last version 8.0.26 of the MySql.Data package, but when trying to connect to the database I'm getting the following error:
MySql.Data.MySqlClient.MySqlException HResult=0x80004005 Message=SSL Connection error. Source=MySql.Data StackTrace: 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.MySqlConnection.Open() at MySqlSSLErrorTest.Program.Main(String[] args) in C:\Users\Murillo\source\repos\MySqlSSLErrorTest\MySqlSSLErrorTest\Program.cs:line 16
This exception was originally thrown at this call stack: System.Net.Security.SslStream.ReceiveBlobAsync(TIOAdapter) System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) System.Threading.Tasks.ValueTask.Result.get() System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable.ConfiguredValueTaskAwaiter.GetResult() System.Net.Security.SslStream.ForceAuthenticationAsync(TIOAdapter, bool, byte[], bool)
Inner Exception 1: AggregateException: One or more errors occurred. (Cannot determine the frame size or a corrupted frame was received.)
Inner Exception 2: IOException: Cannot determine the frame size or a corrupted frame was received.
Now, as I've been searching, it seems that the version 8.0.26 it's comming with some changes as stated here at the MySql website regarding this issue (maybe?), but I haven't been able to understand what exactly are the changes I need to make to my Connection String to make it work.
Here I leave a very simple Console App example to reproduce the error:
class Program
{
static void Main(string[] args)
{
MySqlConnection con = new MySqlConnection("DATABASE=myDB; data source=localhost; user=root; PASSWORD=pass; POOLING=FALSE;");
con.Open(); //ERROR HERE
}
}
I'm aware that I can downgrade the package to an older version to make it work, but I would like to understand how to solve this issue in order to be up to date with the latest features.
Thanks!