LispWorks User Guide and Reference Manual > 19 Common SQL > 19.2 Initialization > 19.2.8 Connecting to MySQL

NextPrevUpTopContentsIndex Special instructions for MySQL on Mac OS X

Download the 32-bit or 64-bit MySQL package to match your LispWorks image.

The downloadable packages from the MySQL web site contain only static client libraries, but LispWorks needs a dynamic library. You need to create the dynamic library, for example by using the following shell command.

To build the 32-bit dynamic library:

gcc -dynamiclib -fno-common \
	-o /usr/local/mysql/lib/libmysqlclient_r.dylib \
	-all_load /usr/local/mysql/lib/libmysqlclient_r.a -lz

To build the 64-bit dynamic library:

gcc -m64 -dynamiclib -fno-common \
	-o /usr/local/mysql/lib/libmysqlclient_r.dylib \
	-all_load /usr/local/mysql/lib/libmysqlclient_r.a -lz

This command should be executed as the root user, or some other user with write permission to the /usr/local/mysql/lib directory and assumes that MySQL was installed in /usr/local/mysql , which is the location used by the prepackaged downloads.

An alternate way to create a dynamic library is to build MySQL from its source code with the --enable-shared flag.

By default, LispWorks expects to find the library either in /usr/local/mysql/lib or on the shared library path. This can be overridden by setting the special variable *mysql-library-directories*.

By default, LispWorks expects the library to be called libmysqlclient.*.dylib and it searches for a library that matches that pattern, where * is any version number. This search can be avoided by setting *mysql-library-path* to something other than the default ( "-lmysqlclient" ), for example, it is possible to force LispWorks to look for version 12 by evaluating

(setq *mysql-library-path* "libmysqlclient.12")

You can also set *mysql-library-path* to a full path, which avoids the need to set *mysql-library-directories*.

If the environment variable LW_MYSQL_LIBRARY . is set, then its value is used instead of the value of *mysql-library-path*.

LispWorks User Guide and Reference Manual - 22 Dec 2009