Thursday, August 16, 2007

Perl DBD::mysql with a custom MySQL

With MySQL performance being so core to our business, we keep very up to date with MySQL. We customarily use the latest 5.0 production release for stability reasons.

One tool we use, mytop, is based on Perl. With Perl we need DBI and DBD::mysql. DBI is usually not an issue to install

> cpan
cpan> install DBI

But to install DBD::mysql you need a little unneeded theatrics to get to work. For this example, we've installed a precompiled mysql binary into /usr/local/mysql

cpan> get DBD::mysql
cpan> look DBD::mysql

# perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config
# make
# make install

Before this will work, we need to add /usr/local/mysql/lib to the default search path for ld.

Add another line to /etc/ld.so.conf

/usr/local/mysql/lib

then run this command

> ldconfig

and all is good!

No comments: