Mysql – How to add a reference to the MySQL connector for .NET


What does this mean: Next add reference to: MySql.Data

actually I have downloaded mysql connector/net.
by following these instructions:

First, you need to install the mysql connector/net, it is located at:

Next create a new project

Next add reference to: MySql.Data

Next add "using MySql.Data.MySqlClient;"
but im not able to install the connector.


Best Solution

"Add a reference to MySql.Data.dll" means you need to add a library reference to the downloaded connector. The IDE will link the database connection library with your application when it compiles.

Step-by-Step Example

I downloaded the binary (no installer) zip package from the MySQL web site, extracted onto the desktop, and did the following:

  1. Create a new project in Visual Studio
  2. In the Solution Explorer, under the project name, locate References and right-click on it. Select "Add Reference".
  3. In the "Add Reference" dialog, switch to the "Browse" tab and browse to the folder containing the downloaded connector. Navigate to the "bin" folder, and select the "MySql.Data.dll" file. Click OK.
  4. At the top of your code, add using MySql.Data.MySqlClient;. If you've added the reference correctly, IntelliSense should offer to complete this for you.