[MDEV-28723] MySQL Connector fails to connect to MariaDB Created: 2022-06-01  Updated: 2022-06-20  Resolved: 2022-06-20

Status: Closed
Project: MariaDB Server
Component/s: Protocol
Affects Version/s: 10.4.25, 10.5.16, 10.6.8
Fix Version/s: 10.2.6

Type: Bug Priority: Major
Reporter: Mauro Mazzieri Assignee: Sergei Golubchik
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-10541 Faking the version string only works ... Closed
Problem/Incident
is caused by MDEV-4088 Replication 10.0 -> 5.5 fails Closed
Relates
relates to MDEV-28910 remove the 5.5.5- version hack Closed

 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 MySQL.

I suggest to fix the initial version string, so that MariaDB is recognized as version 10 for example.



 Comments   
Comment by Mauro Mazzieri [ 2022-06-01 ]

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

Comment by Daniel Black [ 2022-06-01 ]

version is a system read only variable that you can set in the configuration file. In the protocol level its doing 5.5.5-10.4.25 however explicitly setting this will correspond the the exact version that MySQL Connector/NET sees.

Comment by Bradley Grainger [ 2022-06-02 ]

MySqlConnector (https://www.nuget.org/packages/MySqlConnector/ ) is routinely tested with MariaDB and is recommended by the MariaDB documentation: https://mariadb.com/kb/en/mysqlconnector-for-adonet/

It's also much less buggy than MySQL Connector/NET: https://mysqlconnector.net/tutorials/migrating-from-connector-net/#fixed-bugs

(disclaimer: I'm the lead developer of MySqlConnector)

Edit: Now I see you're using EF; there's no EF support in MySqlConnector; it can only be used with plain ADO.NET or EF Core.

Comment by Sergei Golubchik [ 2022-06-20 ]

5.5.5- will removed in MDEV-28910

Generated at Thu Feb 08 10:02:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.