Installing Perl DBD, DBI::mysql Modules
under Mac OS X

Apache - Perl - MySQL
The Big Picture

Installing and Setting Up MySQL

Installing MySQL Perl DBI:DBD Modules

Testing Apache - Perl - MySQL

In order for you to use Perl to communicate with MySQL, you will need to install the Perl DBI and DBD::mysql modules. This process is quite straightfoward and standardized.

To "make" the Perl modules, you MUST install the Mac OS X Developer tools which are on their own CD. These tools must match the version of Mac OS X you are running.

1. Goto

http://www.cpan.org/modules/by-category/07_Database_Interfaces/DBD/

Scroll down to the latest MySQL DBD driver file (currently DBD-mysql-2.1020.tar.gz) and click to download it.

After this is complete, scroll down to download the latest Database Interface driver file (currently DBI-1.30.tar.gz).

Both folders should have automatically extracted after downloading. Drag both folders into the Library/Perl folder (directory).

IF the "tar.gz" files which you downloaded did NOT automatically extract, then still drag the files into the Library/Perl folder and open a Terminal window. Extract the folders with the commands:

sudo gunzip DBD-mysql-2.1020.tar.gz

sudo tar -xvf DBD-mysql-2.1020.tar

sudo gunzip DBI-1.30.tar.gz

sudo tar -xvf DBI-1.30.tar.gz

2. Open a Terminal Window. Enter:

cd /Library/Perl/DBI-1.30 (or whatever version of the DBI module you have downloaded)

sudo Perl Makefile.PL

sudo make

sudo make install

You have now installed the Perl DBI module.

3. Install the Perl MySQL DBD module:

cd /Library/Perl/DBD-mysql-2.1020 (or whatever version of the DBD module you have downloaded)

sudo Perl Makefile.PL

sudo make

sudo make install

You have now installed the Perl MySQL DBD module.