简体   繁体   中英

Why can't I install DBD::mysql so I can use it with Maatkit?

I'm trying to install Maatkit following the maatkit instructions . I can't get past having to install DBD::mysql. "Warning: prerequisite DBD::mysql 1 not found." When I try to install DBD::mysql from cpan, I get very helpful "make had returned bad status, install seems impossible".

Perl is "v5.8.8 built for darwin-thread-multi-2level", the one that came with OS X. I also tried building from source with same result.

We need more of the error message. Most likely, you are missing the MySQL client development files. I don't know how to install these on OSX. Also see this older post on OSX 10.5.2 , in which some other failures with the mysql client libraries are found.

Possibly post this question with more parts of your error message at perlmonks.org , if stackoverflow doesn't allow for convenient pasting of your make session or rather the last 20 or 10 lines of it.

Some more Googling with site:perlmonks.org also finds this post which has some more details on things to watch out for when installing DBD::MySQL. Depending on how comfortable you feel with the installation, you might want to manually run the tests, supplying a test database and test user or even skip testing the module.

After a bit more googling, this worked for me:

sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
sudo ln -s /usr/local/mysql/include /usr/local/mysql/include/mysql
sudo perl -MCPAN -e 'install Bundle::DBD::mysql'

press enter a bunch of times, then in your maatkit folder:

perl Makefile.PL
sudo make install

and you'll find the mk-* programs in /usr/local/bin/

You will want to install MySQL first. I usually use the binary packages they provide for OS X. The packages do include the headers and MySQL client libraries which DBD::MySQL requires. Once the MySQL package is installed, DBD::MySQL should install without issue.

Here is my output:

$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Warning: prerequisite DBD::mysql 1 not found.
Writing Makefile for maatkit

$ mysql --version
mysql  Ver 14.12 Distrib 5.0.51b, for apple-darwin9.0.0b5 (i686) using readline 5.0

I notice that there are in effect DBD::MySQL packages in the fink repositories. For example:

ayaz@ayazs-macbook$ fink list | grep -i 'dbd-mysql'
    dbd-mysql-pm586 3.0008-10   Perl5 Database Interface to MySQL
    dbd-mysql-pm588 3.0008-10   Perl5 Database Interface to MySQL

Perhaps installing through fink one of those packages may help alleviate your troubles.

Also, and I cannot be certain of this, you may want to install for MySQL-5.x (if you have that version installed) the mysql15-dev and mysql15-shlibs packages. I installed those through fink thus:

$ sudo fink --use-binary-dist install mysql15-dev

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM