A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Compiling DBD::mysql for Perl on Mac OSX

I will tell you how:


1. install the version of mysql you want

e.g. to:

~/opt/mysql/8.0.22

Maybe use dbdeployer for this (see other post)

2. set up the environment

Note: This step is at your own risk, it's not recommended.

MYSQL_DIR="~/opt/mysql/8.0.22"

ln -s $MYSQL_DIR/lib/libmysqlclient.21.dylib /usr/local/lib/libmysqlclient.21.dylib
ln -s $MYSQL_DIR/lib/libcrypto.1.1.dylib     /usr/local/lib/libcrypto.1.1.dylib
ln -s $MYSQL_DIR/lib/libssl.1.1.dylib        /usr/local/lib/libssl.1.1.dylib

3. download the DBD::mysql tarball from CPAN, unpack it install it

perl Makefile.PL --mysql_config=$MYSQL_DIR/bin/mysql_config
make
make install

Alternatively...

Make sure mysql_config is in your path, and that's it! DBD::mysql will now build normally.