Obtaining the Source Code
A TAR file containing the source code can be downloaded from the MySQL Developers site. You will need to select the source code package from the drop down list.
The source code for development releases of the connector can be found at Launchpad. The project home page can be found here.
The source code for the 1.0 branch can be found here.
To obtain the code you will need to have Bazaar installed and use
the command bzr branch lp:libmysql
.
Building on Unix
Examples of supported Unix or Unix-like operating systems include:
Solaris
Linux
HP-UX
AIX
OS X
Compiler Tools
Ideally, the native compiler tool set for the target platform is used for compilation. This would be SunStudio for Solaris and aCC for HP-UX for example. However, the GNU tool-chain can be used across all platforms.
You also need CMake 2.6 or newer, which is available online.
To Build
If using GNU AutoTools change to the MySQL Connector/C source directory and follow the procedure below.
To generate the makefile enter:
shell> cmake -G "Unix Makefiles"
or for a Debug build enter:
shell> cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
Then build the project using:
shell> make
To Install
By default make install will install the MySQL Connector/C files in the
/usr/local
directory. You can change this behavior by specifying another directory when generating themakefile
:shell> cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/mypath
Now, in the root shell, enter the following to install the MySQL Connector/C libraries and tools:
root-shell> make install
At this point all of the MySQL Connector/C files will be in place.
Building on Microsoft Windows
Older versions of Microsoft Windows are not supported. Supported versions are Windows 2000, Windows XP, Windows Vista, Windows Server 2003, or Windows Server 2008.
Compiler Tools
Microsoft Visual Studio 8 and 9 are recommended. The Express Edition of Visual Studio and other compilers may work, but are untested.
You also need CMake 2.6 or newer, available at http://www.cmake.org
To Build
You need to have the environment variables set for the Visual Studio toolchain. Visual Studio includes a batch file to set these for you, and installs a shortcut into the Start menu to open a command prompt with these variables set.
Build MySQL Connector/C using the CMake command-line tool by entering the following from the source root directory in a command prompt window:
shell> cmake -G "Visual Studio 9 2008"
This produces a project file that you can open with Visual Studio or build from the command line with either of:
shell> devenv.com libmysql.sln /build Release
shell> devenv.com libmysql.sln /build RelWithDebInfo
For other versions of Visual Studio or
nmake
based build, run the following command:shell> cmake --help
to check the supported generators.
To compile the Debug build, you must run set the CMake build type so the correct version of external libraries are used:
shell> cmake -G "Visual Studio 8 2005" -DCMAKE_BUILD_TYPE=Debug
Followed by:
shell> devenv.com libmysql.sln /build Debug
To Install
To create a install package you can choose between two variants:
Creating a Zip package
Creating an MSI install package
Zip package
To create a Zip package, run the
cpack
command from the root of your MySQL Connector/C source directory.MSI Install package
The required tools include Windows XML Installer toolset (WIX), which is available online.
To create the MSI install package change to the subdirectory
win
and generate themakefile
:shell> cmake -G "NMake Makefiles"
Create the MSI install package by calling
nmake
:shell> nmake
Build Options
The following options can be used when building the MySQL Connector/C source code:
Build Option | Description |
---|---|
-DWITH_OPENSSL=1 | Enables dynamic linking to the system OpenSSL library. |
-DWITH_EXTERNAL_ZLIB=1 | Enables dynamic linking to the system Zlib library. |