4.5 Building Connector/ODBC from a Source Distribution on Unix

You need the following tools to build MySQL from source on Unix:

Once you have all the required files, unpack the source files to a separate directory, then run cmake with the following command:

shell> cmake -G "Unix Makefiles"

Typical cmake Parameters and Options

You might need to help cmake find the MySQL headers and libraries by setting the environment variables MYSQL_INCLUDE_DIR, MYSQL_LIB_DIR, and MYSQL_DIR to the appropriate locations; for example:

shell> export MYSQL_INCLUDE_DIR=/usr/local/mysql/include
shell> export MYSQL_LIB_DIR=/usr/local/mysql/lib
shell> export MYSQL_DIR=/usr/local/mysql

When you run cmake, you might add options to the command line. Here are some examples:

Build Steps for Unix

To build the driver libraries, execute make:

shell> make

Note that if you are using make from Sun, you might end up with errors. On the other hand, GNU gmake should work on most platforms. If any errors occur, correct them and continue with the build process. If you are not able to finish the build, send a detailed email to for further assistance.

Installing Driver Libraries

To install the driver libraries, execute the following command:

shell> make install

For more information on build process, refer to the BUILD file that comes with the source distribution.

Testing Connector/ODBC on Unix

Some tests for Connector/ODBC are provided in the distribution with the libraries that you built. To run the tests:

  1. Make sure you have an odbc.ini file in place, by which you can configure your DSN entries. A sample odbc.ini file is generated by the build process under the test folder. Set the environment variable ODBCINI to the location of your odbc.ini file.

  2. Set up a test DSN in your odbc.ini file (see Section 5.5, “Configuring a Connector/ODBC DSN on Unix” for details ). A sample DSN entry, which you can use for your tests, can be found in the sample odbc.ini file.

  3. Set the environment variable TEST_DSN to the name of your test DSN.

  4. Set the environment variable TEST_UID and perhaps also TEST_PASSWORD to the user name and password for the tests, if needed. By default, the tests use root as the user and do not enter a password; if you want the tests to use another user name or password, set TEST_UID and TEST_PASSWORD accordingly.

  5. Make sure that your MySQL server is running.

  6. Run the following command:

    shell> make test