How to install DBD::mysql on 10.2

Sep 15, '03 10:21:00AM

Contributed by: matteoceruti

I recently installed perl 5.8.0 and therefore had to reinstall the Perl module DBD::mysql, because there were binary incompatibilities. The normal procedure for DBD::mysql is:

perl Makefile.PL
make
...
But this did not work, and I got compiler errors:
In file included from dbdimp.c:29:
dbdimp.h:31:49: mysql.h: No such file or directory
dbdimp.h:32:49: errmsg.h: No such file or directory
In file included from dbdimp.c:29:
dbdimp.h:116: error: parse error before "MYSQL"
dbdimp.h:116: warning: no semicolon at end of struct or union
............snip
I found that the default values for some flags (location of mysql-libs and headers) seemed to be wrong (at least on my system), and so the neccesary files could not be found. My mysql installation is located at /usr/local/mysql, and I had to slightly adjust the --lib and --cflag settings (see README file). I used (shown on two lines; enter as one with just a space before "--libs"):
perl Makefile.PL --cflags=-I/usr/local/mysql/include/
   --libs="-L/usr/local/mysql/lib -lmysqlclient -lz"
So if you have similar problems, make sure the locations of the header and lib files match. Hope this is useful.

Comments (9)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030910180006632