Unable to connect to mysql from visual studio 2015

So, I already spent about 2 days trying to fix this. I managed to fix this in my workplace and cannot make it work on my home computer. I read about a dozen SO articles and oracle articles, but nothing else, but it still won't work.

I have 1.2.4 msql for visual studio, which should be a release that works on vs2015. I installed mysql connector 6.8.6 and first tried adding mysql to my project via nuget, but after I could not find version 6.8.6 (for one package there are 6.8.3 and 6.9.7, and then again something else for another ...) I referenced my C: \ Program Files (x86) \ MySQL \ MySQL Connector Net 6.8.6 \ Assemblies \ v4.5 files and took 4 files there and copied them to the whole fkin computer. I inserted it, as everywhere else. Personal vs2013 build, my packages folder, which I don’t even refer to, and I think some vs2015 folders. I ran a Mysql.Data search and pasted these files into every folder that appeared as a result. I restored the solution about 100-200 times and cried for at least 20 minutes.

What do I need to do to create a new Entity Data ADO.Net data model?

I keep getting this nonsense enter image description here image, and I really don't know what to do next. I just want to code, but every time I start to do something, I continue to spend days on broken tools. Do I really need to code in notepad so I'm sure it is my fault that something is not working?

This is my app.Config file. I have nothing else in my project.

<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </configSections> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <parameters> <parameter value="v12.0" /> </parameters> </defaultConnectionFactory> <providers> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> </providers> </entityFramework> <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, Version=6.8.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> </DbProviderFactories> </system.data> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-6.8.6.0" newVersion="6.8.6.0" /> </dependentAssembly> </assemblyBinding> </runtime> <connectionStrings> <add name="KPlusConnectionString" connectionString="server=dito.ninja;user id=xxx;password=xxx;database=xxx" providerName="MySql.Data.MySqlClient" /> </connectionStrings> </configuration> 
+7
mysql visual-studio mysql-connector visual-studio-2015
source share
5 answers

For VS 2015 to connect to MySql, you need to use a later version of MySql libraries. Although this seems like a fairly simple answer, to be honest, I ran into several problems along the way. With that in mind, I'm going to write out 1 process that worked for me sequentially, since EF works with MySql and VS2015. So, without further ado, here are the steps I took to get this to work.

1) Make sure the installation of the MySql connector is updated

2) Create your web project

3) Open Nuget

4) Install Entity Framework

5) Search MySql

6) Install MySql.Data p>

7) Install MySql.Data.Entity

8) Install MySql.Data.Entities

9) Install MySql.Web

10) Go to the links for the project and delete MySql.Data.Entity.EF6

11) Check the versions of the MySql.Data and MySql.Web libraries. If they are less than 6.9.6, delete them as well.

12) Add a new link by going to the installation folder for the mysql connector for your version of the .NET framework (my is C: \ Program Files (x86) \ MySQL \ Connector.NET 6.9 \ Assemblies \ v4. 5) and capture MySql.Data .Entity.EF6.dll (my version is 6.9.6, remember this when we change web.config later)

13) If other libraries were also older versions, add links to them by going to the packages folder in your solution and grabbing files from their respective folders. Usually I do not.

14) Now Web.config will need to be edited. The first step is to replace the entity structure section with this code (change the version number to the current version. Please note that I found this fragment on the Internet a couple of weeks ago and did not have the original link. We apologize for the original poster of this information.)

 <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> 

15) Make sure the DbProviderFactories section matches

 <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, Version=6.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> </DbProviderFactories> 

16) Save and build

I’m not sure how many of these steps are really required, but finally, having received it, I had to actually do some work and did not have time to narrow the matter down yet. Hope this makes you move.

PS If after all this you go through the wizard and it just disappears before it shows you the tables in the database for creating entities, then this may be one of the three problems that I encountered. The database server cannot be contacted. The user does not have the required permissions for the database. The wrong version of MySql.Data.Entity.EF6 was added as a link or the version number is incorrect in web.config. If I take this file from the package directory of my solution, I often encounter this problem with an intermittent wizard with no error. Grabbing it from the MySql installation directory, it worked perfectly for me every time.

+13
source share

This works for me. I have Visual Studio 2015 and have just installed the latest version of the connector: http://dev.mysql.com/downloads/windows/visualstudio/

Read this more carefully: http://dev.mysql.com/doc/relnotes/mysql-for-visual-studio/en/visual-studio-news-1-2-4.html

They mention that the version of "Microsoft ASP.NET MVC" may be a problem. It is not true that they say that VS2015 comes with version 5, but I have version 4 installed with the end of VS2015 Enterprise.

+3
source share

Tried this and it did not work for me. In the end, I worked to make sure that I have the right driver. I am running a 64-bit computer with Windows 7. In the end, I had to install the 32-bit version of the MySQL ODBC connector / driver and use the following connection string: "Provider = MSDASQL; Driver = {MySQL ODBC 5.3 ANSI Driver]; Server = localhost; Database = xxxx; User = xxxx; password = xxxx; Option = 3; " and it decided. tested it on a new project, not having implemented all the above changes, and it worked perfectly. This post was very helpful in explaining this: https://support.microsoft.com/en-us/kb/942976 . Hope this saves you a lot of time.

0
source share

Install the package from this site. http://dev.mysql.com/downloads/windows/visualstudio/ on the Release release tab.

I stopped Visual Studio .. I installed. WAITED .. Sutures take forever. Visual studio will run in the background.

Wait for it to complete.

reopen Visual Studio. Arrow back to the game!

Good luck

0
source share
  • For VS2015, I uninstalled the entire version and installed it through MySql Installer - Community. I chose Customize Installation and the selected MySQL connectors to install: 1. MySql for Visual Studio 2) MySQl ConnectorNet.

  • I added links: MySql.Data y MySql.Data.Entity.EF5 as in C: \ Program Files (x86) \ MySQL \ Connector.NET 6.9 \ Assemblies \ v4.5 \

  • Recompiled project And when creating the ADO.Net object, the famous MySql data provider was shown! There was a warning about Frame Entity Frame versions, I just clicked Next and it works! [Enter a description of the image here] [1]

0
source share

All Articles