You need to download the Source to MySQL 5, it’s the tar file called mysql-5.0.xx.tar.gz (xx is version number), unpack it and open a Terminal session where you cd into the source directory and execute the following commands. Please note the different configure instructions for Intel or PowerPC based Macs:

Note: For compilation on Leopard please look here for 64 bits mode and here for 32 bits mode.

Tiger 10.4.x, for Intel:

CFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" \
./configure -prefix=/usr/local/mysql \
 -localstatedir=/usr/local/mysql/data \
 -libexecdir=/usr/local/mysql/bin \
 -libdir=/usr/local/mysql/lib \
 -with-server-suffix=-standard \
 -enable-thread-safe-client \
 -enable-local-infile \
 -enable-shared \
 -with-zlib-dir=bundled \
 -with-big-tables \
 -with-readline \
 -with-archive-storage-engine \
 -with-innodb \
 -without-docs \
 -without-bench

Tiger 10.4.x, for PowerPC:

CFLAGS="-arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" \
./configure -prefix=/usr/local/mysql \
 -localstatedir=/usr/local/mysql/data \
 -libexecdir=/usr/local/mysql/bin \
 -libdir=/usr/local/mysql/lib \
 -with-server-suffix=-standard \
 -enable-thread-safe-client \
 -enable-local-infile \
 -enable-shared \
 -with-zlib-dir=bundled \
 -with-big-tables \
 -with-readline \
 -with-archive-storage-engine \
 -with-innodb \
 -without-docs \
 -without-bench

For all:

make

sudo make install

And now you’ve got a proper MySQL installation with shared libraries. Which means you can compile and install all kinds of software that requires access to MySQL databases.

Next step: Securing your MySQL install