Recently my web host decided to switch to MariaDB from MySQL. Since then, I get the following error whenever a page tries to connect to the database. "Versions of MySQL prior to 5.6 are not currently supported". I’m using ASP.NET MVC, with Entity First, with the following packages installed MySql.Data 8.0.28, MySql.Data.Entities 6.8.3, MySql.Data.EntityFramework 8.0.28, MySqlConnector 2.1.8. They are all up-to-date as of writing this.
My web.config file has the following:
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="MySql.Data.MySqlClient"
type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework"/>
<provider invariantName="System.Data.SqlClient"
type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=8.0.28.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
</entityFramework>
I have tried looking and cannot find much on this error. I’m not sure if this would be something on the host’s end or something I can fix on my end since all of the packages are up-to-date.
2
Answers
At the time of writing, versions of MySql.Data from 8.0.22 to the current 8.0.29 are affected by this problem, and will not connect to MariaDB. This is tracked in Bug #107452.
The current workaround is to use version 8.0.21
As a bug mentioned by @Richard, There is a workaround to pass this error.
It actually is a bug of MySql.Data package where there is a wrong version parsing and comparing if the minor number has 2 digits.
So all you need is to set the version number (to 9.9.0 for example) in the my.ini file:
Restart the MariaDB server,
Done!