1

Iam developing an asp.net mvc web application, and I have a commercial system which i want to connect to its MySQL database. so i decide to use the entity framework inside an asp.net mvc web application.

but when i tired to create a new connection i can not find an option to connect to the MySQL server, as shown below:-

enter image description here

So is there an option to connect to MSQL server instead of SQL server?

  • i download the zip file, then added the .dll files in the reference section of visual studio ,, but still the new connection does not show MYSQL –  Jul 02 '13 at 10:45
  • Should get postgresql instead of mysql. – Phill Jul 09 '13 at 02:09

3 Answers3

1

Install MySQL Connector for .NET, restart your Visual Studio and try again.

UPDATE:

Sometimes installing the Connector is not enough for Visual Studio integration. see https://stackoverflow.com/a/4257203 for solution.

Community
  • 1
  • 1
haim770
  • 48,394
  • 7
  • 105
  • 133
  • thanks for the reply, i download the zip file, then added the .dll files in the reference section of visual studio ,, but still the new connection does not show MYSQL ? –  Jul 02 '13 at 10:43
  • @JohnPeter try to use nuget – Roar Jul 02 '13 at 10:54
0

It better to user Nuget and install MySql.Data from there than install .NET connector. First of all use of connector will cause the situation that you need to install connector to your server environment. Also, if tomorrow you will install new version of connector locally you should reinstall it on server also (you cannot have 2 versions of connector to be installed on same machine, so web applications that user older version will stop working).

All you need to do it's use Nuget Packet manager, search for MySQL.Data and install it. Also (i dont remember its by default done) you should go to property of this reference in solution and set it to always copy locally. That's it, all should work.

[Update] Also, to navigate in mysql is better to use native mysql tools, like MySQL Workbench. It has much more possebility

Evgeniy Labunskiy
  • 2,012
  • 3
  • 27
  • 45
  • Thanks for your help, i install it using Nuget, and by default the Copy local is set to true. but at the end MySQL did not show up when creating a new database connection.... –  Jul 02 '13 at 12:30
  • To have it in this pop up, there 2 ways: istall rpovider manually (see haim770 reply). Or to install connector only for this purpose. This is the options that i see – Evgeniy Labunskiy Jul 02 '13 at 12:59
  • if i do not want to see it in the pop-up , what other way i can connect EF with MySQL? thanks –  Jul 02 '13 at 14:35
  • Try to use EF Code First – Evgeniy Labunskiy Jul 10 '13 at 14:59
0

You may need to use the MySQL Installer for Windows:

http://dev.mysql.com/tech-resources/articles/mysql-installer-for-windows.html

I read somewhere that it's the only way to get VS support now.

Aaron
  • 93
  • 2
  • 2
  • 6