end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

DBD::mysqlのinstallは、mysql_configやtestuserを指定しましょう

DBD:a:mysqlをinstallする際、単純に実行すると、エラーで怒られてしまいます。

例えば、perl Makefile.PLでは...

$ cd DBD-mysql-4.010
$ /usr/local/bin/perl Makefile.PL
Can't exec "mysql_config": No such file or directory at Makefile.PL line 76.
<略>

例えば、make testでは...

$ make test
<略>
t/76multi_statement.........ok                                               
t/80procs...................ok 1/29DBD::mysql::db do failed: execute command denied to user ''@'localhost' for routine 'test.testproc' at t/80procs.t line 63.
DBD::mysql::db do failed: execute command denied to user ''@'localhost' for routine 'test.testproc' at t/80procs.t line 63.
# Looks like you planned 29 tests but only ran 4.
# Looks like your test died just after 4.
t/80procs...................dubious                                          
        Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 5-29
        Failed 25/29 tests, 13.79% okay
Failed Test Stat Wstat Total Fail  List of Failed
-------------------------------------------------------------------------------
t/80procs.t  255 65280    29   50  5-29
1 test skipped.
Failed 1/34 test scripts. 25/704 subtests failed.
Files=34, Tests=704,  7 wallclock secs ( 3.73 cusr +  1.82 csys =  5.55 CPU)
Failed 1/34 test programs. 25/704 subtests failed.
make: *** [test_dynamic] Error 255

環境によって、エラーメッセージの内容は、これ以外もあるかもしれませんが、大抵の場合、mysql_configやtestuserを指定することで解消できます。

$ /usr/local/bin/perl Makefile.PL \
   --mysql_config=/usr/local/mysql/bin/mysql_config \
   --testuser=root
   # rootを指定している私もどうかと思いますが
$ make
$ make test
# make install