Installing MySQL on Mac Snow Leopard

27 Jul 2011 by Arthur Clemens in Mac tagged MySQL, Perl, DBI, DBD

Tips how to install MySQL on Snow Leopard and have it work with Perl

I just spent a day figuring out how to get MySQL working together with Perl. Here's a couple of tips:
  • Download the .dmg package installer from http://dev.mysql.com/downloads/mysql/, it is more recent than MacPorts
  • Make sure that installers install the 64 bit version. Add to your ~/.profile:
    export ARCHFLAGS="-arch x86_64"
    export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/:$DYLD_LIBRARY_PATH
    
    and update the Terminal window with source ~/.profile
  • For DBI and DBD::mysql, don't use the CPAN installer but download the source files from CPAN and install manually
  • Check where these libraries are installed and add the Perl folder path to @INC
  • Fix the link to libmysqlclient.18.dylib with
    sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
    

Comments

Leave your comment