How to Install DBD::mysql on Mac OSX Server 10.4.7 Universal
Okay after 3 days and very little sleep and trying all sorts of variations I finally got DBD::mysql to work.
For those that are interested I'll post how I figured this out at the end of this post but for now here are the steps I used:
Configuration: Mac Pro 2 x 2.66 Core2Duo/ OSX 10.4.7 Server Universal
NOTE: This may or may not work for those attempting to install on a different version of the server. For those who are attempting this with an older version of OSX please see my tip here.
1. install OSX Server 10.4.7 Universal Binary
(I always install everything as root. I don't want to hear anyone tell me i'm wrong for doing this. I do it this way.. you can do sudo if thats what you like!)
2. install X Code (at this writing its v. 2.4)
3. install MySQL 5x (I didn't want to use the one that Apple supplied since I wanted v.5)
*also note that you might need to have a database called test installed for this to work.
4. turn mysql on
5. open terminal and attempt to install DBD::mysql from CPAN. Type this:
sudo perl -MCPAN -e 'install Bundle::DBD::mysql'
NOTE: this install will fail but it will get you to the point you need to get to.
6. Let's fix the config now!
cd to your .cpan in the terminal:
cd ~/.cpan/build/DBD-mysql-[version]
sudo perl Makefile.PL \
--cflags="-I/usr/local/mysql/include" \
--libs="-L/usr/local/mysql/lib -lmysqlclient -lz -lm -lcrypt -lnsl"
make
make test
make install
7. Test to make sure that it works!
If you're interested in how I figured this out:
This morning I decided to try installing DBD::mysql on the non-server version of OSX that came with my MacPro just to see if it would work. I did the same procedure above, except: 1. It was standard MacOSX 10.4.7 not the Server version, 2. I only had to do up to step 5. Yep you read that right, DBD::mysql installed correctly the first time straight from CPAN!
Seeing that it installed without a hitch I decided to go ahead and see if the configs for DBD::mysql were any different and sure enough they were:
On the 10.4.7 SERVER this was the configuration that DBD::mysql would use:
cflags (mysql_config) = -I/usr/include/mysql -fno-omit-frame-pointer -arch ppc64 -arch x86_64 -pipe
embedded (mysql_config) =
libs (mysql_config) = -arch ppc64 -arch x86_64 -pipe -L/usr/lib/mysql -lmysqlclient -lz -lm
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testsocket (default ) =
testuser (default ) =
On 10.4.7 Standard edition this is what the config looked like:
cflags (User's choice) = -I/usr/local/mysql/include
embedded (mysql_config ) =
libs (User's choice) = -L/usr/local/mysql/lib -lmysqlclient -lz -lm -lcrypt -lnsl
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testsocket (default ) =
testuser (default ) =
So what I did was go back in and let CPAN install DBD::mysql, then go back and change its Makefile.PL settings to the the standard 10.4.7 settings. And now I've got movable type, mysql5, PHP5, apache2 all running nicely together on my Mac Pro. Thank God!
I'm no perl programmer or anything but something in MacOSX Server 10.4.7 universal is telling DBD::mysql to use those cflags and libs settings instead of the "correct" ones.
Hopefully this helps someone out there. It might not work on all installs but it worked for me and this version of the OSX Server.