Connect to a MySQL database from Visual Studio 2017

As of today weI can connect to a MySQL database, but cannot generate the Entity Data Model from a MySQL database in Visual Studio 2017

To access a MySQL database from Visual Studio 2017

IMPORTANT: First install MySQL for Visual Studio, and after that install MySQL Connector/Net.

If MySQL Connector/Net is already installed on your workstation, uninstall it before installing MySQL for Visual Studio and reinstall MySQL Connector/Net.

Install MySQL for Visual Studio

Available version information is at https://dev.mysql.com/doc/visual-studio/en/visual-studio-intro.html

  1. Close all instances of Visual Studio,
  2. Download the installer from https://dev.mysql.com/downloads/windows/visualstudio/
  3. Start the installer
  4. Click the Complete button,
  5. If you select Typical, make sure the Visual Studio 2017 components are selected

 

Install the MySql Connector/Net the fully-managed ADO.NET driver for MySQL

  1. Download the installer from https://dev.mysql.com/downloads/connector/net/
  2. Download version 6.9.10, because version 6.10.5 throws the

    Inheritance security rules violated by type: ‘MySql.Data.Entity.MySqlEFConfiguration’. Derived types must either match the security accessibility of the base type or be less accessible

    error. More info at https://stackoverflow.com/questions/47227495/inheritance-security-rules-violated-by-type-mysql-data-entity-mysqlefconfigura

  3. Select version 6.9.10, your operating system and click the Download button
  4. If you don’t want to create an Oracle account, click the No thanks… link
  5. Start the downloaded installer
  6. Click the Complete button

Install the NuGet packages

Make sure to install the same version of the NuGet packages as the MySql Connector/Net

Join the Conversation

4 Comments

  1. Thank you very much. Only your post help me to connect to MySQL data base using Entity Framework. The trick is version Connector C# and MySQL.Data.Entity6 shuld be the SAAAAAAAME. For me version of Connector and Nuget Package MySQL.Data.Entity6 – 6.9.12 have worked

  2. Thanks to your usefull article, I fillanly was able to connect to MySQL database with Entity Framework.
    If I had not found this article, I would have gave up using MySQL database with Entity Framework.
    Again, I really appreciate you!

  3. I have done all you described above but i got an error continuously as below:

    Could not get column information for database object named

Leave a comment

Your email address will not be published. Required fields are marked *