Assumes OSX Server 10.4+ MySql as installed by Apple.
Whenever you compile from source code it is necessary to have Xcode installed. It's a free download from Apple Developer Connection.
Before you install DBD-mysql you will need to build through CPAN "Bundle::DBI".
sudo cpan install Bundle::DBI quit
Enable MySql to run. Create a database called "test" (if you don't already have one) and make sure that "root" or whatever username you're using is able to access the "test" database with your MySql password. Login as "root" during the installation. Be sure to edit below "testuser" and "testpassword" otherwise your installation will not be successful.
Before you can compile DBD::mysql it is necessary that you edit Apple's "mysql_config" file.
open -e /usr/bin/mysql_config
replacing ldflags=' -pipe'
with ldflags=''
curl -O http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.005.tar.gz gunzip DBD-mysql-4.005.tar.gz tar -xvf DBD-mysql-4.005.tar cd DBD-mysql-4.005
perl Makefile.PL --testdb=test --testuser=root --testpassword=secret make make test make install