2005年08月28日

ユーザ権限でのインストール(DBD::mysql)


MTをユーザ権限で全部動かしてみようと思います。

次はDBD::mysqlのインストールを行ってみたいと思います。

まずはCPANでDBD::mysql含まれているモジュールを探したいと思います。
次のURLからCPANにアクセスします。

http://search.cpan.org/

DBD::mysqlを検索するとDBD-mysqlに含まれていることが判明しました。

次のURLからDBD-mysql-2.9008.tar.gzをダウンロードします。

http://search.cpan.org/~rudy/DBD-mysql-2.9008/
インストールは次のようにしてインストールします。

tar zxvf DBD-mysql-2.9008.tar.gz
cd DBD-mysql-2.9008
/home/ikepon.jp/perl/bin/perl Makefile.PL
Can't locate DBI/DBD.pm in @INC (@INC contains: /home/ikepon.jp/perl/lib/5.8.5/i386-freebsd /home/ikepon.jp/perl/lib/5.8.5 /home/ikepon.jp/perl/lib/site_perl/5.8.5/i386-freebsd /home/ikepon.jp/perl/lib/site_perl/5.8.5 /home/ikepon.jp/perl/lib/site_perl .) at Makefile.PL line 24.

DBI::DBDが足りないようなので再びCPANにて検索します。
DBIに含まれていることが判明しました。

次のURLからDBI-1.48.tar.gzをダウンロードします。

http://search.cpan.org/~timb/DBI-1.48/

DBIを次のようにしてインストールします。

tar zxf DBI-1.48.tar.gz
cd DBI-1.48
/home/ikepon.jp/perl/bin/perl Makefile.PL
gmake
gmake test
gmake install

DBD-mysqlに戻ってインストールします。

cd DBD-mysql-2.9008
/home/ikepon.jp/perl/bin/perl Makefile.PL
Can't exec "mysql_config": No such file or directory at Makefile.PL line 73.

Cannot find the file 'mysql_config'! Your execution PATH doesn't seem
not contain the path to mysql_config. Resorting to guessed values!
Can't exec "mysql_config": No such file or directory at Makefile.PL line 248.
Can't exec "mysql_config": No such file or directory at Makefile.PL line 248.
Can't exec "mysql_config": No such file or directory at Makefile.PL line 248.
Can't exec "mysql_config": No such file or directory at Makefile.PL line 248.
Can't exec "mysql_config": No such file or directory at Makefile.PL line 248.
Can't exec "mysql_config": No such file or directory at Makefile.PL line 248.
Failed to determine directory of mysql.h. Use

  perl Makefile.PL --cflags=-I<dir>

to set this directory. For details see the INSTALL.html file,
section "C Compiler flags" or type

  perl Makefile.PL --help
setenv PATH /home/ikepon.jp/mysql/bin:$PATH
export PATH=/home/ikepon.jp/mysql/bin:$PATH

/home/ikepon.jp/perl/bin/perl Makefile.PL
gmake
gmake test
PERL_DL_NONLAZY=1 /home/ikepon.jp/perl/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00base...........ok
t/10dsnlist........DBI connect('test','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/10dsnlist.t line 45
Cannot connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
        Either your server is not up and running or you have no
        permissions for acessing the DSN DBI:mysql:test.
        This test requires a running server and write permissions.
        Please make sure your server is running and you have
        permissions, then retry.
t/10dsnlist........dubious
        Test returned status 10 (wstat 2560, 0xa00)
DIED. FAILED tests 1-9
        Failed 9/9 tests, 0.00% okay
t/20createdrop.....DBI connect('test','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/20createdrop.t line 45
Cannot connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
        Either your server is not up and running or you have no
        permissions for acessing the DSN DBI:mysql:test.
        This test requires a running server and write permissions.
        Please make sure your server is running and you have
        permissions, then retry.
t/20createdrop.....dubious
        Test returned status 10 (wstat 2560, 0xa00)
DIED. FAILED tests 1-5
        Failed 5/5 tests, 0.00% okay
t/30insertfetch....DBI connect('test','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/30insertfetch.t line 48
Cannot connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
        Either your server is not up and running or you have no
        permissions for acessing the DSN DBI:mysql:test.
        This test requires a running server and write permissions.
        Please make sure your server is running and you have
        permissions, then retry.
t/30insertfetch....dubious
        Test returned status 10 (wstat 2560, 0xa00)
DIED. FAILED tests 1-11
        Failed 11/11 tests, 0.00% okay
t/40bindparam......DBI connect('test','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/40bindparam.t line 64
Cannot connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
        Either your server is not up and running or you have no
        permissions for acessing the DSN DBI:mysql:test.
        This test requires a running server and write permissions.
        Please make sure your server is running and you have
        permissions, then retry.
t/40bindparam......dubious
        Test returned status 10 (wstat 2560, 0xa00)
DIED. FAILED tests 1-28
        Failed 28/28 tests, 0.00% okay
t/40blobs..........DBI connect('test','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/40blobs.t line 68
Cannot connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
        Either your server is not up and running or you have no
        permissions for acessing the DSN DBI:mysql:test.
        This test requires a running server and write permissions.
        Please make sure your server is running and you have
        permissions, then retry.
t/40blobs..........dubious
        Test returned status 10 (wstat 2560, 0xa00)
DIED. FAILED tests 1-11
        Failed 11/11 tests, 0.00% okay
t/40listfields.....DBI connect('test','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/40listfields.t line 57
Cannot connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
        Either your server is not up and running or you have no
        permissions for acessing the DSN DBI:mysql:test.
        This test requires a running server and write permissions.
        Please make sure your server is running and you have
        permissions, then retry.
t/40listfields.....dubious
        Test returned status 10 (wstat 2560, 0xa00)
DIED. FAILED tests 1-18
        Failed 18/18 tests, 0.00% okay
t/40nulls..........DBI connect('test','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/40nulls.t line 50
Cannot connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
        Either your server is not up and running or you have no
        permissions for acessing the DSN DBI:mysql:test.
        This test requires a running server and write permissions.
        Please make sure your server is running and you have
        permissions, then retry.
t/40nulls..........dubious
        Test returned status 10 (wstat 2560, 0xa00)
DIED. FAILED tests 1-11
        Failed 11/11 tests, 0.00% okay
t/40numrows........DBI connect('test','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/40numrows.t line 59
Cannot connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
        Either your server is not up and running or you have no
        permissions for acessing the DSN DBI:mysql:test.
        This test requires a running server and write permissions.
        Please make sure your server is running and you have
        permissions, then retry.
t/40numrows........dubious
        Test returned status 10 (wstat 2560, 0xa00)
DIED. FAILED tests 1-25
        Failed 25/25 tests, 0.00% okay
t/50chopblanks.....DBI connect('test','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/50chopblanks.t line 57
Cannot connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
        Either your server is not up and running or you have no
        permissions for acessing the DSN DBI:mysql:test.
        This test requires a running server and write permissions.
        Please make sure your server is running and you have
        permissions, then retry.
t/50chopblanks.....dubious
        Test returned status 10 (wstat 2560, 0xa00)
DIED. FAILED tests 1-35
        Failed 35/35 tests, 0.00% okay
t/50commit.........DBI connect('test','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/50commit.t line 64
Can't call method "tables" on an undefined value at t/lib.pl line 216.
t/50commit.........dubious
        Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 1-30
        Failed 30/30 tests, 0.00% okay
t/60leaks..........skipped
        all skipped: $ENV{SLOW_TESTS} is not set or Proc::ProcessTable not installed
t/ak-dbd...........DBI connect('test','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/ak-dbd.t line 59
t/ak-dbd...........ok 3/91Can't call method "tables" on an undefined value at t/lib.pl line 216.
t/ak-dbd...........dubious
        Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 1, 4-91
        Failed 89/91 tests, 2.20% okay
t/akmisc...........Mysql connect('database=test;host=','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/akmisc.t line 140
t/akmisc...........NOK 1Cannot connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
        It looks as if your server is not up and running.
        This test requires a running server.
        Please make sure your server is running and retry.
t/akmisc...........dubious
        Test returned status 10 (wstat 2560, 0xa00)
DIED. FAILED tests 1-352
        Failed 352/352 tests, 0.00% okay
t/dbdadmin.........DBI connect('test','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/dbdadmin.t line 74
t/dbdadmin.........NOK 1Cannot connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
        Either your server is not up and running or you have no
        permissions for acessing the DSN DBI:mysql:test.
        This test requires a running server and write permissions.
        Please make sure your server is running and you have
        permissions, then retry.
t/dbdadmin.........dubious
        Test returned status 10 (wstat 2560, 0xa00)
DIED. FAILED tests 1-21
        Failed 21/21 tests, 0.00% okay
t/insertid.........DBI connect('test','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/insertid.t line 13
t/insertid.........dubious
        Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 1-12
        Failed 12/12 tests, 0.00% okay
t/mysql............Mysql connect('database=test;host=','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/mysql.t line 55
not ok 1: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
        It looks as if your server is not up and running.
        This test requires a running server.
        Please make sure your server is running and retry.
FAILED before any test output arrived
t/mysql2...........Mysql connect('database=test;host=','',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at t/mysql2.t line 29
Can't call method "getserverinfo" on an undefined value at t/mysql2.t line 30.
t/mysql2...........dubious
        Test returned status 255 (wstat 65280, 0xff00)
Failed Test       Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
t/10dsnlist.t       10  2560     9   17 188.89%  1-9
t/20createdrop.t    10  2560     5    9 180.00%  1-5
t/30insertfetch.t   10  2560    11   21 190.91%  1-11
t/40bindparam.t     10  2560    28   55 196.43%  1-28
t/40blobs.t         10  2560    11   21 190.91%  1-11
t/40listfields.t    10  2560    18   35 194.44%  1-18
t/40nulls.t         10  2560    11   21 190.91%  1-11
t/40numrows.t       10  2560    25   49 196.00%  1-25
t/50chopblanks.t    10  2560    35   69 197.14%  1-35
t/50commit.t       255 65280    30   59 196.67%  1-30
t/ak-dbd.t         255 65280    91  177 194.51%  1 4-91
t/akmisc.t          10  2560   352  703 199.72%  1-352
t/dbdadmin.t        10  2560    21   41 195.24%  1-21
t/insertid.t       255 65280    12   24 200.00%  1-12
t/mysql.t                       ??   ??       %  ??
t/mysql2.t         255 65280    ??   ??       %  ??
1 test skipped.
Failed 16/18 test scripts, 11.11% okay. 725/732 subtests failed, 0.96% okay.
*** Error code 2

Stop in /home/ikepon.jp/mt3/DBD-mysql-2.9008.

mysqlが起動していないのでエラーが出ています。
次のコマンドにてmysqlを起動します。

/home/ikepon.jp/mysql/share/mysql/mysql.server start

再度インストールします。

gmake test
gmake install

次のURLにアクセスして、DBD::mysqlがインストールされているのが確認します。

http://www.ikepon.jp/mt/mt-check.cgi

最終的に、インストールするためのスクリプトは次のようになります。

install_mysql.sh
#!/bin/sh

BUILD_HOME=`pwd`

cd ${BUILD_HOME}
tar zxvf mysql-4.1.14.tar.gz
cd mysql-4.1.14
./configure --prefix=/home/ikepon.jp/mysql
gmake
gmake install
cd /home/ikepon.jp/mysql/
bin/mysql_install_db --user=hiro --datadir=/home/ikepon.jp/mysql/var
 

Comment on "ユーザ権限でのインストール(DBD::mysql)"

"ユーザ権限でのインストール(DBD::mysql)"へのコメントはまだありません。