Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have mostly seen ASP.NET websites using MSSQL as database. Even I developed one some time ago. Why only MSSQL, when MySQL, a free alternative is available. So, the question is, IS it possible to integrate a MySQL database as easily as MSSQL with ASP.NET application or we need to use some API for doing so ??

share|improve this question
SqlServer Express -- which is very commonly used by MS-stack developers -- is free, too. – Adam Crossland Aug 11 '11 at 14:14
Then why people select MSSQL over MySQL if the integration is easy enough. Cost is not a big factor but still a factor. Both of them are equally good, but MySQL is free – Pankaj Upadhyay Aug 11 '11 at 14:40
Out of the box integration with SQL Server is a big selling point and Visual Studio ships with all kinds of fancy tools that make it easy to generate models and entities. Its the same reason the PHP-MySQL combo became so popular: quick and easy. – Jarrod Nettles Aug 11 '11 at 14:42
After you calculate in the developer's time, it might as well be cheaper to deploy a MS SQL Server than MySQL. – Boris Yankov Aug 11 '11 at 14:48
How well do the MS tools work with MySQL? How easy is it for developers who know MS-SQL and its tools to shift things over to the MySQL way? That's a cost you aren't considering here I think. – JB King Aug 11 '11 at 14:56
up vote 6 down vote accepted

I have had an ASP.NET/C#/MySQL web app running in production for about 3 years now. It runs well. I also use it for all of my side jobs too. The ADO.NET connector plugs in to visual studio and works just as well as the SQLSERVER connector. There are a few gotchas though. 1st, there is not a free equivalent of SQLSERVER's Management Studio as far as I have found. I use Aqua Data Studio, but it costs a bit. There are some free RDMSs for MySQL, but they are by no means comparable to Management Studio. I hear eclipse has a plugin for MySQL that is pretty good and free, and I haven't tried that one. Also, in MySQL you can not ALTER a stored procedure, you can only drop and create. This causes a few pains in the A in visual studio.

The ADO.NET MySQL connector is fully polymorphic with the System.Data and the System.Data.SqlClient namespaces so it is easy to have multiple versions of a database for SQLSERVER and MySQL simultaneously. This is useful if you have a customer who is a MS crony who says crap like, "We are a microsoft only shop!" as if he actually knows what he is talking about. This happens more than you might realize. Then, you can just use your old SQLSERVER code instead without having to do any additional coding--if you have a good design to begin with.

My last critique is that MySQL is notorious for not maintaining backwards compatibility between the .NET connector and different versions of their DB engine. This is fine as long as you are deploying the server with MySQL on it, but if you are deploying the site to a hosting provider, beware!

It is worth the extra effort in my opinion, though it has some of the inherent flaws that many open source projects have. It is, in my experience, just as scalable and faster than ms sqlserver, while if you know T-SQL, you will pickup on the MySQL syntax relatively quickly.

share|improve this answer
thanks mate, that was really helpful and great answer to my question – Pankaj Upadhyay Aug 11 '11 at 17:18
You can use MySql Workbench, which is free and similar to MSSQL Server Management Studio – Jetti Jan 31 '12 at 15:28
@Jetti Indeed you can, and the latest release is quite nice. It still doesn't hold a candle to Management Studio. However, I absolutely love Aqua Data Studio. I use it for all of my DB projects--SQLSERVER, MySQL, Oracle and so on... – Jonathan Henson Jan 31 '12 at 15:31

ASP.NET as a web technology and is not tied to any specific database. As such, you can use NHibernate or standard data access methods to connect to MySQL on the backend.

share|improve this answer

If you are switching from one database to another during the course of a project you might have some purely database related tasks (data migration) to perform if you used Sql Server specific types. Also, if you wrote stored procedures, you have to rewrite them all.

Otherwise, and for new projects, no problem at all. Just use the ADO.NET connector:

And, as Ryan wrote, with ADO.NET you can connect to any database you want as long as someone wrote the connector for it. And there are... many.

share|improve this answer

Your application can connect to the database just as easily, but you may be missing out on some of the Visual Studio integrations for SQL Server (SQL Server Projects). If you don't care or aren't too attached to them, then it doesn't matter.

share|improve this answer

You can use MySQL with ASP.NET MVC, as everybody else has said before. The one thing that you will be losing is CLR Integration with SQL Server. It is nice to be able to write stored procedures in C# if you have complex calculations and that is something you can't duplicate by using MySQL.

share|improve this answer

Your Answer


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.