Table of Contents
MySQL Connector/Net runs on any platform that supports the .NET Framework. The .NET Framework is primarily supported on recent versions of Microsoft Windows, and is supported on Linux through the Open Source Mono platform.
Connector/Net is available for download from the MySQL Installer, as a standalone .msi, or from the MySQL NuGet repository.
On Microsoft Windows, you can install either through a binary installation process using a Connector/Net MSI, choose the MySQL Connector/Net product from the MySQL Installer, using Nuget, or by downloading and using the Source.
Before installing, ensure that your system is up to date, including installing the latest version of the .NET Framework.
MySQL Installer provides an easy to use, wizard-based installation experience for all MySQL software on Windows. It can be used to install and upgrade your MySQL Connector/Net installation.
To use, download and install MySQL Installer.
After executing MySQL Installer, choose and install the MySQL Connector/Net product.
You install MySQL Connector/Net through a Windows Installer
(.msi) installation package, which can
install Connector/Net on supported Windows operating systems.
The MSI package is a file named
mysql-connector-net-,
where version.msiversion indicates the
Connector/Net version.
Using the central MySQL Installer is recommended, instead of the standalone package that is documented in this section. The MySQL Installer is available for download at MySQL Installer.
To install Connector/Net:
Double-click the MSI installer file, and click to start the installation.
You must choose the type of installation to perform.
For most situations, the Typical installation is suitable. Click the button and proceed to Step 5. A Complete installation installs all the available files. To conduct a Complete installation, click the button and proceed to step 5. To customize your installation, including choosing the components to install and some installation options, click the button and proceed to Step 3.
The Connector/Net installer will register the connector within the Global Assembly Cache (GAC) - this will make the Connector/Net component available to all applications, not just those where you explicitly reference the Connector/Net component. The installer will also create the necessary links in the Start menu to the documentation and release notes.
If you have chosen a custom installation, you can select the individual components to install, including the core interface component, supporting documentation (a CHM file) samples and examples, and the source code. Select the items, and their installation level, and then click to continue the installation.
You will be given a final opportunity to confirm the installation. Click to copy and install the files onto your machine.
Once the installation has been completed, click to exit the installer.
Unless you choose otherwise, Connector/Net is installed in
C:\Program Files (x86)\MySQL\MySQL Connector Net
, where
X.X.XX.X.X is replaced with the version of
Connector/Net you are installing. New installations do not
overwrite existing versions of Connector/Net.
Depending on your installation type, the installed components will include some or all of the following components:
Assemblies: Connector/Net MySQL libraries
for different versions of the .NET environment.
Documentation: Connector/Net
documentation in CHM format.
Samples: Sample code and applications
that use the Connector/Net component.
You may also use the /quiet or
/q command-line option with the
msiexec tool to install the Connector/Net
package automatically (using the default options) with no
notification to the user. Using this method the user cannot
select options. Additionally, no prompts, messages or dialog
boxes will be displayed.
C:\> msiexec /package connector-net.msi /quiet
To provide a progress bar to the user during automatic
installation, use the /passive option.
There is no installer available for installing the Connector/Net component on your Unix installation. Before installing, ensure that you have a working Mono project installation. To test whether your system has Mono installed, enter:
shell> mono --version
The version of the Mono JIT compiler is displayed.
To compile C# source code, make sure a Mono C# compiler is installed.
There are three Mono C# compilers available:
mcs, which accesses the 1.0-profile
libraries, gmcs, which accesses the
2.0-profile libraries, and dmcs, which
accesses the 4.0-profile libraries.
To install Connector/Net on Unix/Mono:
Download the
mysql-connector-net-
and extract the contents to a directory of your choice, for
example: version-noinstall.zip~/connector-net/.
In the directory where you unzipped the connector to, change
into the bin subdirectory. Ensure the
file MySql.Data.dll is present. This
filename is case-sensitive.
You must register the Connector/Net component,
MySql.Data, in the Global Assembly Cache
(GAC). In the current directory enter the
gacutil command:
root-shell> gacutil /i MySql.Data.dll
This will register MySql.Data into the GAC.
You can check this by listing the contents of
/usr/lib/mono/gac, where you will find
MySql.Data if the registration has been
successful.
You are now ready to compile your application. You must ensure
that when you compile your application you include the
Connector/Net component using the -r:
command-line option. For example:
shell> gmcs -r:System.dll -r:System.Data.dll -r:MySql.Data.dll HelloWorld.cs
The referenced assemblies depend on the requirements of the
application, but applications using MySQL Connector/Net must provide
-r:MySql.Data at a minimum.
You can further check your installation by running the compiled program, for example:
shell> mono HelloWorld.exe
Source packages of Connector/Net are available for download from http://dev.mysql.com/downloads/connector/net/.
The file contains the following directories:
Documentation: Source files to build the
documentation into the compiled HTML (CHM) format, code
examples, collection files, and licenses for third-party
components.
Samples: Source files for several example
applications.
Source\MySQL.ConnectorInstaller: Source
files to build the Connector/Net installer program.
Source\MySQL.Data: Source files for the
core data provider.
Source\MySQL.Data.Entity: Source files
for the Entity Framework.
Source\MySQL.Web: Source files for the
web providers, including the membership/role/profile providers
that are used in ASP.NET web sites.
Tests: Test cases for Connector/Net.
The following procedure can be used to build the connector on Microsoft Windows.
Navigate to the root of the source code tree.
A Microsoft Visual Studio solution file named
MySqlClient.sln is available to build the
connector. Click this file to load the solution into Visual
Studio.
MySqlClient.sln must be compiled with VS
2008, VS 2010, or VS 2012. Also, depending on the version, the
dependencies to build it include Visual Studio SDK, NUnit,
Entity Framework, and ANTLR Integration for Visual Studio.
Select , from the main menu to build the solution.
Support for building Connector/Net on Mono/Unix is not available.