Join the Stack Overflow Community
Stack Overflow is a community of 6.5 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

My database originally built with MSSQL but recently I've migrated it over to MySql. However, now I need to connect it to my MVC project (existing). I tried doing it by utilizing the Entity Framework wizard but get the following error message.

Error message

I read along and found that I need some classes that are required for MySql to work with Visual Studio and added the following NuGet packages. I even installed the MySql Microsoft package (with the connector + MySql for Visual Studio).

NuGet packages

Even with all the packages installed I still get this error message. How can I connect my existing MVC project to a MySql database?

share|improve this question

Maybe you have already found yourself a solution, but if you didn't, try: Tools -> NuGet Package Manager -> Package Manager Console, and update-package entityframework I've been through this myself. ;-)

share|improve this answer

Check what version of MySql.Data.Entity you have installed. I have 6.9.5, and it worked for me.

To update, run Update-Package MySql.Data.Entity in the Package Manager Console

You may have to add the -Pre for the pre-release version.

share|improve this answer

Try to change you web.config, add this

<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" />
    </providers>
  </entityFramework>

and this to

<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" />
    </DbProviderFactories>
  </system.data>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.