【问题标题】:Versions of MySQL prior to 5.6 are not currently supported目前不支持 5.6 之前的 MySQL 版本
【发布时间】:2022-12-09 13:09:46
【问题描述】:

最近我的虚拟主机决定从 MySQL 切换到 MariaDB。从那时起,每当页面尝试连接到数据库时,我都会收到以下错误。 “当前不支持 5.6 之前的 MySQL 版本”。我正在使用 ASP.NET MVC,实体优先,安装了以下包 MySql.Data 8.0.28、MySql.Data.Entities 6.8.3、MySql.Data.EntityFramework 8.0.28、MySqlConnector 2.1.8。在撰写本文时,它们都是最新的。

我的 web.config 文件具有以下内容:

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

我试过寻找但找不到太多关于这个错误的信息。我不确定这是主机端的问题还是我可以解决的问题,因为所有软件包都是最新的。

【问题讨论】:

标签: c# mysql asp.net entity-framework mariadb


【解决方案1】:

在撰写本文时,从 8.0.22 到当前 8.0.29 的 MySql.Data 版本受此问题影响,并且无法连接到 MariaDB。这是在Bug #107452 中跟踪的。

当前的解决方法是使用版本 8.0.21

【讨论】:

  • 这是正确答案。我在连接到旧的 MySQL 数据库时遇到问题,将版本降级到 8.0.21 后错误消失了!谢谢
【解决方案2】:

作为@Richard 提到的错误,有一种解决方法可以传递此错误。 其实是MySql.Data包的一个bug,如果minor number有2位,版本解析比较错误。 所以你只需要在 my.ini 文件中设置版本号(例如 9.9.0): 重新启动 MariaDB 服务器, 完毕!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-19
    • 1970-01-01
    • 2021-12-30
    • 2023-03-20
    • 1970-01-01
    • 2021-09-10
    相关资源
    最近更新 更多