Can't connect to MySql database with Entity Framework 6

connection-string database-connection dbcontext entity-framework-6 mysql

Question

Installed via NuGet: MySql.Data, MySql.Data.Entities, MySql.Data.Entity.

Web.config:

<connectionStrings>
  <add name="WhateverEntities" providerName="MySql.Data.MySqlClient" connectionString="server=127.0.0.1;port=3306;database=dbname;uid=root;password=pass" />
<connectionStrings>

...

<entityFramework>
  <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </providers>
<entityFramework>

ApplicationDbContext.cs:

public ApplicationDbContext() : base(nameOrConnectionString: "WhateverEntities") {}

tried to add:

[DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]

and:

[DbConfigurationType(typeof(MySqlEFConfiguration))]

got this error:

An exception of type 'System.Data.Entity.Core.ProviderIncompatibleException' occurred in EntityFramework.dll but was not handled in user code

Additional information: The provider did not return a ProviderManifestToken string.

What's wrong?

1
0
4/23/2015 7:17:34 PM

Popular Answer

It was a matter of password as vdwijngaert suggested. Changed it in PhpMyAdmin.

1
4/24/2015 3:13:10 PM


Related Questions





Related

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