I downloaded and installed MySQL Community Server 5.5.15 from http://dev.mysql.com/downloads/mysql/5.5.html
Using CPAN, I then tried to install DBD::mysql on a fresh install of OS X Lion and was presented with an error saying it was unable to load the library.
# Error: Can’t load ‘/private/var/root/.cpan/build/DBD-mysql-4.019-H1RD6j/blib/arch/auto/DBD/mysql/mysql.bundle’ for module DBD::mysql: dlopen(/private/var/root/.cpan/build/DBD-mysql-4.019-H1RD6j/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Library not loaded: libmysqlclient.18.dylib
# Referenced from: /private/var/root/.cpan/build/DBD-mysql-4.019-H1RD6j/blib/arch/auto/DBD/mysql/mysql.bundle
After a bit of searching, I came across http://probably.co.uk/problems-installing-dbdmysql-on-os-x-snow-leopard.html which although it’s for Snow Leopard has a very similar error and the fix works great on Lion as well.
$ sudo install_name_tool -id /usr/local/mysql-5.5.15-osx10.6-x86_64/lib/libmysqlclient.18.dylib /usr/local/mysql-5.5.15-osx10.6-x86_64/lib/libmysqlclient.18.dylib
$ otool -D `mdfind libmysqlclient.18.dylib`
After running the name_install command, DBD::mysql built and tested correctly.