Installation

MySQL Connector/Net

Installation
Connector/Net Installation

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 framework (see http://www.mono-project.com).

Connector/Net is available for download from http://dev.mysql.com/downloads/connector/net/.

Installing Connector/Net on Windows

On Windows, installation is supported either through a binary installation process or by downloading a Zip file with the Connector/Net components.

Before installing, ensure that your system is up to date, including installing the latest version of the .NET Framework.

Installing Connector/Net using the Installer

Using the installer is the most straightforward method of installing Connector/Net on Windows and the installed components include the source code, test code and full reference documentation.

Connector/Net is installed through the use of a Windows Installer (.msi) installation package, which can be used to install Connector/Net on all Windows operating systems. The MSI package in contained within a Zip archive named mysql-connector-net-version.zip, where indicates the Connector/Net version.

To install Connector/Net:

  1. Double-click the MSI installer file extracted from the Zip you downloaded. Click Next to start the installation.

  2. You must choose the type of installation to perform.

    For most situations, the Typical installation is suitable. Click the Typical button and proceed to Step 5. A Complete installation installs all the available files. To conduct a Complete installation, click the Complete button and proceed to step 5. To customize your installation, including choosing the components to install and some installation options, click the Custom 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.

  3. 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 Next to continue the installation.

    Note Note

    For Connector/Net 1.0.8 or lower and Connector 5.0.4 and lower the installer will attempt to install binaries for both 1.x and 2.x of the .NET Framework. If you only have one version of the framework installed, the connector installation may fail. If this happens, you can choose the framework version to be installed through the custom installation step.

  4. You will be given a final opportunity to confirm the installation. Click Install to copy and install the files onto your machine.

  5. Once the installation has been completed, click Finish to exit the installer.

Unless you choose otherwise, Connector/Net is installed in C:\Program Files\MySQL\MySQL Connector Net X.X.X, where 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:

  • bin: Connector/Net MySQL libraries for different versions of the .NET environment.

  • docs: Connector/Net documentation in CHM format.

  • samples: Sample code and applications that use the Connector/Net component.

  • src: The source code for 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.

Installing Connector/Net using the Zip packages

If you are having problems running the installer, you can download a Zip file without an installer as an alternative. That file is called mysql-connector-net-version-noinstall.zip. Once downloaded, you can extract the files to a location of your choice.

The file contains the following directories:

  • bin: Connector/Net MySQL libraries for different versions of the .NET environment.

  • Docs: Connector/Net documentation in CHM format.

  • Samples: Sample code and applications that use the Connector/Net component.

Connector/Net 6.0.x has a different directory structure:

  • Assemblies: A collection of DLLs that make up the connector functionality.

  • Documentation: Connector/Net documentation in CHM format.

  • Samples: sample code and applications that use the Connector/Net component.

There is also another Zip file available for download called mysql-connector-net-version-src.zip. This file contains the source code distribution.

The file contains the following directories:

  • Documentation: Source files to build the documentation into the compiled HTML (CHM) format.

  • Installer: Source files to build the Connector/Net installer program.

  • MySql.Data: Source files for the core data provider.

  • MySql.VisualStudio: Source files for the Microsoft Visual Studio extensions.

  • MySql.Web: Source files for the web providers. This includes code for the membership provider, role provider and profile provider. These are used in ASP.NET web sites.

  • Samples: Source files for several example applications.

  • Tests: A spreadsheet listing test cases.

  • VisualStudio: Resources used by the Visual Studio plugin.

Finally, ensure that MySql.Data.dll is accessible to your program at build time (and run time). If using Microsoft Visual Studio, add MySql.Data as a Reference to your project.

Note Note

If using 6.3.5 and above, the MySql.Data file provided will work with both .NET Framework 2.x and 4.x.

Installing Connector/Net on Unix with Mono

There is no installer available for installing the Connector/Net component on your Unix installation. Before installing, please ensure that you have a working Mono project installation. You can test whether your system has Mono installed by typing:

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. Note that there are two Mono C# compilers available, mcs, which accesses the 1.0-profile libraries, and gmcs, which accesses the 2.0-profile libraries.

To install Connector/Net on Unix/Mono:

  1. Download the mysql-connector-net-version-noinstall.zip and extract the contents to a directory of your choice, for example: ~/connector-net/.

  2. In the directory where you unzipped the connector to, change into the bin directory. Ensure the file MySql.Data.dll is present.

  3. 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 command-line option. For example:

shell> gmcs -r:System.dll -r:System.Data.dll -r:MySql.Data.dll HelloWorld.cs

Note, the assemblies that are referenced depend on the requirements of the application, but applications using Connector/Net must provide as a minimum.

You can further check your installation by running the compiled program, for example:

shell> mono HelloWorld.exe
Installing Connector/Net from the source code

Obtaining the source code

To obtain the most recent development source tree, you first need to download and install Bazaar. You can obtain Bazaar from the Bazaar VCS Website. Bazaar is supported by any platform that supports Python, and is therefore compatible with any Linux, Unix, Windows or Mac OS X host. Instructions for downloading and installing Bazaar on the different platforms are available on the Bazaar Web site.

The most recent development source tree is available from our public Subversion trees at http://dev.mysql.com/tech-resources/sources.html.

To check out out the Connector/Net sources, change to the directory where you want the copy of the Connector/Net tree to be stored, then use the following command:

shell> bzr branch lp:connectornet/trunk

To download a specific version of Connector/Net, specify the version number instead of trunk. For example, to obtain a copy of the 6.0 version of the source tree:

shell> bzr branch lp:connectornet/6.0

Source packages are also available on the downloads page.

Building the source code on Windows

The following procedure can be used to build the connector on Microsoft Windows.

  • Obtain the source code, either from the Subversion server, or through one of the prepared source code packages.

  • Navigate to the root of the source code tree.

  • A Microsoft Visual Studio 2005 solution file is available to build the connector, this is called MySQL-VS2005.sln. Click this file to load the solution into Visual Studio.

  • Select Build, Build Solution from the main menu to build the solution.

Building the source code on Unix

Support for building Connector/Net on Mono/Unix is currently not available.