MySQL and C# Entity Framework "ProviderIncompatibleException"

c# entity-framework entity-framework-6 mysql


i'm following the MySql tutorial to entity framework as listed here:

I have installed in my project via NuGet:
- Entity Framework v6.2.0
- MySql.Data.Entity v6.10.7

And their corresponding dependencies.

I have installed the MySql CONNECTOR/NET v8.0.11.

I added the provider and connectionString to the App.config:

  <entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />

    <add name="mysql" connectionString="Server=localhost,3306;Database=eneagramas;Uid=root;Pwd=1234;" providerName="MySql.Data.MySqlClient" />

Basically i followed all the instructions in the official documentation, this is my context class:

class MyContext : DbContext
    public MyContext() : base("mysql")
        //nothing here

    public DbSet<Humans> Humans { get; set; }

YET i get this error when accesing the DB:

  Message=The provider did not return a ProviderManifestToken string.

Inner Exception 1:
MethodAccessException: Attempt by method 'MySql.Data.MySqlClient.MySqlProviderServices.GetDbProviderManifestToken(System.Data.Common.DbConnection)' to access method 'MySql.Data.MySqlClient.MySqlConnection.get_Settings()' failed.
  • I checked my DB credentials, they are fine
  • The server is up and running
  • The database im trying to use exists
7/16/2018 2:02:39 AM

Accepted Answer

You can't use MySql.Data 8.0.11 with MySql.Data.Entity 6.10.7; the major versions are incompatible.

Oracle renamed the package to MySql.Data.EntityFramework for v8. Uninstall MySql.Data.Entity and install MySql.Data.EntityFramework instead.

7/16/2018 2:49:26 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow