TruerWords Logo

Search TruerWords

Sign Up  Log On

How to Install DBD::mysql on Mac OS X 10.3 (Panther)

How to Install DBD::mysql on Mac OS X 10.3 (Panther)

DBD::mysql, the mysql database driver for Perl's database abstraction (DBI), won't install via cpan because of errors during make.

This problem is unofficially acknowledged and documented by Apple's Edward Moy in the MacPerl mailing list archives.

To fix it, download the source and run 'perl'. Normally, the next step would be to run "make," but first you have to fix the Makefile created in the previous step. I'll make it simple, here's a step-by-step:

(Each of these steps are a single line that should be run in the terminal. Watch out for line-wraps!)

Please Note that these instructions assume you have installed MySQL for Mac OS X already.

  1. curl -O

    Download the DBD::mysql source.

    (If you're going to download it through your browser, go to the link above and scroll down the page until you find the DBD-mysql files. You should probably get the latest one, but it's up to you.)

  2. tar xzf DBD-mysql-2.9003.tar.gz


    zcat DBD-mysql-2.9003.tar.gz | tar xf -

    Unzip and untar the source. Recent versions (>6.5) of stuffit are fine, or do it on the command line.

  3. cd DBD-mysql-2.9003
    cd into the new directory.
  4. perl Makefile.PL --testdb=test --testuser=username --testpassword=user_password --testhost=localhost

    run the Makefile.PL script. If you're smart, your mysql doesn't allow anonymous access, so you'll need to specify the username and password for the test scripts to use, with --username= and --password=

    The --testhost argument is optional, if you're hooking up to mysql on your own workstation. If you're testing with a remote server, you'll need to set the server's hostname there.

    (I just provided examples. Change username and user_password to whatever will work on your system.)

  5. perl -pi -e's/MACOSX/env MACOSX/' Makefile

    Fix the new Makefile created by Makefile.PL

  6. make

    Compile it!

  7. make test

    (optional) Test it before installation

    I had three testing errors related to admin functions, but it was only because the username I specified for the tests didn't have full admin privileges. If you get the same errors and you think it's for the same reason, just ignore it.

  8. sudo make install

    That's the last step. DBD::mysql is now installed.

Credit and thanks to Casey West for figuring out the problem with the Makefile (step 5) in the first place.

Page last updated: 10/28/2004

is Seth Dillingham's
personal web site.
From now on, ending a sentence with a preposition is something up with which I will not put. - WC