Documentation Home
Connectors and APIs Manual
Download this Manual
PDF (US Ltr) - 4.1Mb
PDF (A4) - 4.1Mb


Connectors and APIs Manual  /  ...  /  Installing Connector/NET on Unix with Mono

4.3.2 Installing Connector/NET on Unix with Mono

There is no installer available for installing the MySQL 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:

$> 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

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:

  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 subdirectory. Ensure the file MySql.Data.dll is present. This filename is case-sensitive.

  3. You must register the Connector/NET component, MySql.Data, in the Global Assembly Cache (GAC). In the current directory enter the gacutil command:

    #> 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:

$> 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 Connector/NET must provide -r:MySql.Data at a minimum.

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

$> mono HelloWorld.exe