View Full Version : MySQL ODBC Connection String for .NET

April 2nd, 2012, 04:51 PM
If you need to create an ODBC connection to a MySQL Server from ASP.NET, you can use the following connection string

string MyConString = "Driver={MySQL ODBC 5.1 Driver};Server=DatabaseServerAddress;Database=Data baseName;User=UserName;Password=DBPassword;Option= 3"

You will need to replace DatabaseServerAddress with the actual address for your site's database server. To find this info:

Login into the control panel at: https://wcp.hostek.com
Click on the MySQL icon
In the popup that loads, you will see your database's Server Name (eg. mysql7.hostek.com) listed next to the database name. You can use this as the DatabaseServerAddress.

You will also need to replace DatabaseName, UserName, and DBPassword with the actual database name, user name, and password for your database.

NOTE: "Option=3" is a required part of the connection string. If you remove Option=3 from the connection string, you will likely be unable to connect to the database.