Chapter 14. MySQL and PostgreSQL

Although there are some great binary distributions for MySQL and PostgreSQL, both build out of the box on Mac OS X. This chapter describes how to install them from source and get them set up so you can start playing with them. Fink is a good first stop for MySQL or PostgreSQL, since you can use it to install a binary build or compile from source.

You can also get MySQL as a binary package from MySQL AB (http://www.mysql.com), as well as Server Logistics (http://www.serverlogistics.com/). Server Logistics offers a selection of open source packages, one of which is Complete MySQL (http://www.serverlogistics.com/mysql.php), which includes the MySQL server, a System Preferences pane for MySQL, ODBC/JDBC drivers, and documentation.

MySQL

To get the source distribution of MySQL, download the latest tarball from http://www.mysql.com/downloads/. At the time of this writing, the latest production release was the 4.0.x series; we downloaded mysql-4.0.16.tar.gz.

Compiling MySQL

To compile MySQL from source:

  1. Extract the tarball:

    $ cd ~/src
    $ tar xvfz ~/Desktop/mysql-4.0.16.tar.gz
  2. Change to the top-level directory that tar created and run the configure script. We suggest specifying a prefix of /usr/local/mysql so it stays out the way of any other binaries you have in /usr/local.

    $ cd mysql-4.0.16
    $ ./configure --prefix=/usr/local/mysql
  3. Next, type make to compile MySQL. Go get a few cups of coffee (compiling could take 30 minutes or more).

Installing MySQL

If the compilation ...

Get Mac OS X Panther for Unix Geeks, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.