Bug #107452 MySQL Connector fails to connect to MariaDB
Submitted: 1 Jun 19:38 Modified: 19 Aug 16:51
Reporter: Mauro Mazzieri Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:8.0.22 OS:Any
Assigned to: CPU Architecture:Any

[1 Jun 19:38] Mauro Mazzieri
Description:
When MySQL Connector/NET is used to connect to a MariaDB database (tested with 10.4, 10.5 and 10.6), the connection fails with a message "Versions of MySQL prior to 5.6 are not currently supported".

This happens using MySQL.Data.Entity version 8.0.22 or newer.
Versions 8.0.21 works fine, probably beacause the minimum server version was MySQL 5.0 and MariaDB 10.x is incorrectly identified as MySQL 5.

I reported the same bug to MariaDB.

How to repeat:
Use MySQL.Data.Entity 8.0.22 or newer in a .NET Framework 4.8 project to connect to a MariaDB 10.x database

Suggested fix:
fix version detection
[1 Jun 19:46] Mauro Mazzieri
Sample stack trace:

[NotSupportedException: Versions of MySQL prior to 5.6 are not currently supported]
   MySql.Data.MySqlClient.MySqlProviderServices.GetDbProviderManifestToken(DbConnection connection) +520
   System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +115

[ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.]
   System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +375
   System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +92
   System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +63
   System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +225
   System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +213
   System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +957
   System.Data.Entity.Internal.InternalContext.Initialize() +26
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +20
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +69
   System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +21
   System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +66
   System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync(IQueryable`1 source, Expression`1 predicate, CancellationToken cancellationToken) +209
   System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync(IQueryable`1 source, Expression`1 predicate) +172
   Microsoft.AspNet.Identity.EntityFramework.<GetUserAggregateAsync>d__67.MoveNext() +489
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.AspNet.Identity.AsyncHelper.RunSync(Func`1 func) +348
   TaleteWeb.PasswordRecovery.Recupera_OnClick(Object sender, EventArgs e) in C:\TaleteWeb\talete.net\PasswordRecovery.aspx.cs:43
   Telerik.Web.UI.RadButton.OnClick(ButtonClickEventArgs e) +126
   Telerik.Web.UI.RadButton.RaisePostBackEvent(String eventArgument) +299
   System.Web.UI.<ProcessRequestMainAsync>d__523.MoveNext() +9158
[2 Jun 9:53] MySQL Verification Team
Hello Mauro Mazzieri,

Thank you for the report and feedback.

regards,
Umesh
[19 Aug 16:51] Daniel Valdez
Posted by developer:
 
MariaDB Server version number has a prefix of "5.5.5", i.e. "5.5.5-10.9.1-MariaDB"; that's why Connector/NET is recognizing the version number as "5.5".
Since we are focused on our MySQL Server support, we can not extend the approach to include specific MariaDB versions.

--- Server version: 5.5.5-10.9.1-MariaDB mariadb.org binary distribution

You can reach MariaDB and see if they can fix this on their side.

Thanks,
Daniel