MySQL & Visual Studio 2008 Express


I am attempting to add a MySQL database connection to the Database Explorer and am running into some issues. I have spent the last 5 hours researching and trying different solutions without success. Below are the steps that I have taken. Any help will be much appreciated.

  1. Downloaded and installed ADO. NET Driver for MySQL (Connector/NET) 6.0
  2. Added Reference to MySQL. VisualStudio. dll
  3. Went to database explorer, selected Add Connection
  4. neither MySQL Database nor . NET Framework Data Provider for MySQL were available
  5. Failed to add database
  6. removed reference to MySQL .VisualStudio. dll and Added Reference to MySQL. Data. dll
  7. Followed steps above to connect to database…still no MySQL available
  8. Removed reference to MySQL. Data. dll
  9. Attempted to add ODBC datasource
  10. Clicked Add Connection
  11. Selected Microsoft ODBC Data Source
  12. Selected . NET Framework Data Provider for ODBC & clicked Continue
  13. Selected Use Connection String
  14. Added: DRIVER={MySQL ODBC 3. 51 Driver}; SERVER=mysql . mysqlhost . com; PORT=3306;DATABASE=dbName; USER=userName; PASSWORD=passWord; OPTION=3; (with the actual values added for mysql host, database, etc…)
  15. Received error: ERROR[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
  16. Downloaded MySQL Connector ODBC 5.1
    [LIST]Followed above steps again under Add ODBC Datasource. again, unsuccessful

[*]Opened Data Sources (ODBC) in my system (Vista)

  • in ODBC Data Source Administrator, Selected System DNS tab
  • Clicked Add…
  • Selected MySQL ODBC 5.1 Driver
  • Added the following:
  • Data Source Name: MySQL DataSource
  • Description: MySQL connection to dbName
  • Server: mysql. mysqlhost. com Port: 3306
  • User: userName
  • Password: passWord
  • Database: dbName
  • Clicked test and received error - Connection Failed: [HY000][MySQL][ODBC 5.1 Driver]Unknown MySQL server host ‘mysql. mysqlhost. com’ (11004)
  • I verified connection information and it was correct
  • I tested credentials with a PHP database connection script and connected successfully, so the error doesn’t make sense considering the server host was found by PHP.

[]Added User Data Source using same as above and received same error
]finally, tried to add the connection directly to the web. config file

  • Tried adding it both for the mySQL. data. dll and without:
    <remove name=“LocalMySqlServer”/>
    <add name=“MySQL_ConnectionString” connectionString=“SERVER=mysql. mysqlhost. com; PORT=3306;DATABASE=dbName; USER=userName; PASSWORD=passWord; OPTION=3;” />


My overall goal is to be able to add a MySQL database to the Database Explorer to allow me to Build a Data Access Layer via datasets for reference in my web site. I’ve read through a ton of forums/posts and also this site (dev. mysql. com/doc/refman/5.0/en/connector-net-installation. html) but haven’t found a solution.

are you trying to connect to a mysql server on your local machine, or one at your web host? most web hosts don’t allow you to connector to their mysql server over the internet.

trying to connect to a remote server. The hosting company provided a server location to connect to in the format of (mysql. mysqlhost. com) with out the spaces…

Not sure how else i would connect to the db if not over the internet, they do not have a localhost option on the webserver. I have access to the db from any domain as long as i point to the server provided.

i connect to my host’s mysql database quite easily, using HeidiSQL

and if you knew me, and my dislike of installation procedures (“i’d rather have a root canal”), then you’d understand that for me to download, install, and connect to my host with no special knowledge, no complex instructions to follow, and without any problems… is saying a lot for heidi

i’ve used visual studio and it’s no great shakes – why are you killing yourself to use it?

was this PHP script running on the same PC where you have VS running, or was this on the web server?

– Using visual studio b/c my web site is build in ASP.NET/C#

And, yes the PHP script was on a server. After reading ur responses, i downloaded MySQL to my dev machine and connected to localhost via the ODBC connection and all is good. Haven’t tested anything on the live server yet, but expect to change connection string to reflect server db and everything is good. gonna run a test tonight.

Ty for your help…unfortunately, I’ve used VS & MySQL, but never together. There seems to understandably be some differences in using MySQL vs. Access or SQL Server with VS. Do any of you know of a reference site that outlines this info?

what should i give in the server name column during creation of the connection.