Unable to Establish MySQL Connection with Entity Framework 6
While attempting to utilize Entity Framework 6 with MySQL, an issue arises when creating a new ADO.NET Entity model. Despite installing MySQL plugin and connector, MySQL remains unavailable as a connection option.
Investigation
It is determined that this is a known bug related to MySQL. Specifically, it affects users attempting to connect Entity Framework 6 with MySQL Connector .NET 6.8.3 and MySQL for Visual Studio plugin 1.1.3.
Workaround
A workaround is available to resolve this issue. Navigate to the MySQL Connector .NET binary installation folder (typically "C:Program Files (x86)MySQLMySQL Connector Net 6.8.3Assembliesv4.5"). Locate the "MySql.Data.Entity.EF6.dll" file and copy it to the following path: "C:Program Files (x86)Microsoft Visual Studio 12.0Common7IDEPrivateAssemblies".
Additional Steps for Resolve Entity Framework 6 Issue with MySQL
Copy the following DLLs to the MySQL Connector Net installation folder:
<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6"> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> <providers> <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /> </providers> </entityFramework>
Resolution
By following these steps and rebuilding the solution, it should be possible to establish a MySQL connection within Entity Framework 6.
The above is the detailed content of Why Can't I Connect to MySQL with Entity Framework 6?. For more information, please follow other related articles on the PHP Chinese website!