Trubo Linux 10下为Perl安装DBD::Mysql模块

类别:编程语言 点击:0 评论:0 推荐:
Trubo Linux 10下为Perl安装DBD::Mysql模块 by jondy([email protected]) 用到以前写的Windows下的perl连mysql的脚本才发现 没有安DBI模块,在Windows下安装模块用PPM就可以了,很方便 而在linux没有ppm这个文件 linux下使用perl -MCPAN来安装模块,具体用法查看帮助 perl -MCPAN -h perl -MCPAN 初次使用时提示设置,基本上一路回车到选择区域和国家 设置保存在 /usr/lib/perl5/5.8.0/CPAN/Config.pm 设置可以修改此文件或干脆删除它再运行perl -MCAPN -e shell重新设置 下边开始安装 perl -MCPAN -e shell 首先要安装DBI模块,这个在trubolinux10下没问题, cpan> install DBI 然后安装DBD::mysql模块 cpan> install DBD::mysql 提示出错退出: t/mysql2.t 255 65280 ?? ?? % ?? 1 test skipped. Failed 16/18 test scripts, 11.11% okay. 723/730 subtests failed, 0.96% okay. make: *** [test_dynamic] 错误 2 /usr/bin/make test -- NOT OK Running make install make test had returned bad status, won't install without force 向上找发现 Can't exec "mysql_config": 没有那个文件或目录 at Makefile.PL line 174. readline() on closed filehandle PIPE at Makefile.PL line 176. cpan> q 退出 [root@localhost sources]#vim /root/.cpan/build/DBD-mysql-2.9004/Makefile.PL 输入/mysql_config查找发现 open(PIPE, "mysql_config --$param |"); open(PIPE, "/usr/local/mysql/bin/mysql_config --$param |"); #修改此处, 运行 [root@localhost sources]#cd /root/.cpan/build/DBD-mysql-2.9004 [root@localhost sources]#perl Makefile.PL --h Usage: perl /root/.cpan/build/DBD-mysql-2.9004/Makefile.PL [options] Possible options are: --cflags= Use for running the C compiler; defaults to the value of "mysql_config --cflags" --libs= Use for running the linker; defaults to the value of "mysql_config --libs" --testdb= Use the database for running the test suite; defaults to test --testuser= Use the username for running the test suite; defaults to no username --testpassword=

Use the password

for running the test suite; defaults to no password --testhost= Use as a database server for running the test suite; defaults to localhost. --testport=

Use

as the port number of the database; by default the port number is choosen from the mysqlclient library --nocatchstderr Supress using the "myld" script that redirects STDERR while running the linker. --nofoundrows Change the behavoiur of $sth->rows() so that it returns the number of rows physically modified instead of the rows matched --ssl Enable SSL support --help Print this message and exit All options may be configured on the command line. If they are not present on the command line, then mysql_config is called: mysql_config --cflags mysql_config --libs mysql_config --testdb and so on. See the INSTALL.html file for details. 按提示输入 [root@localhost sources]#perl Makefile.PL --testuser=root --testpassword=password 输入数据库的用户名和密码 这次没有提示错误,然后输入 [root@localhost sources]#make [root@localhost sources]#make test [root@localhost sources]#make install 完成安装; 下边是安装时出现错误的完整信息 Running install for module DBD::mysql Running make for R/RU/RUDY/DBD-mysql-2.9004.tar.gz CPAN: Digest::MD5 loaded ok CPAN: Compress::Zlib loaded ok Checksum for /root/.cpan/sources/authors/id/R/RU/RUDY/DBD-mysql-2.9004.tar.gz ok Scanning cache /root/.cpan/build for sizes Deleting from cache: /root/.cpan/build/Msql-Mysql-modules-1.2219 (11.4>10.0 MB) Deleting from cache: /root/.cpan/build/Data-Dumper-2.121 (10.7>10.0 MB) Deleting from cache: /root/.cpan/build/Net-Telnet-3.03 (10.2>10.0 MB) DBD-mysql-2.9004/ DBD-mysql-2.9004/t/ DBD-mysql-2.9004/t/mysql2.t DBD-mysql-2.9004/t/akmisc.t DBD-mysql-2.9004/t/60leaks.t DBD-mysql-2.9004/t/10dsnlist.t DBD-mysql-2.9004/t/ak-dbd.t DBD-mysql-2.9004/t/50chopblanks.t DBD-mysql-2.9004/t/mysql.t DBD-mysql-2.9004/t/lib.pl DBD-mysql-2.9004/t/40blobs.t DBD-mysql-2.9004/t/40nulls.t DBD-mysql-2.9004/t/insertid.t DBD-mysql-2.9004/t/40listfields.t DBD-mysql-2.9004/t/40bindparam.t DBD-mysql-2.9004/t/mysql.dbtest DBD-mysql-2.9004/t/dbdadmin.t DBD-mysql-2.9004/t/20createdrop.t DBD-mysql-2.9004/t/00base.t DBD-mysql-2.9004/t/30insertfetch.t DBD-mysql-2.9004/t/40numrows.t DBD-mysql-2.9004/t/50commit.t DBD-mysql-2.9004/t/mysql.mtest DBD-mysql-2.9004/MANIFEST DBD-mysql-2.9004/myld DBD-mysql-2.9004/dbdimp.c DBD-mysql-2.9004/lib/ DBD-mysql-2.9004/lib/DBD/ DBD-mysql-2.9004/lib/DBD/mysql/ DBD-mysql-2.9004/lib/DBD/mysql/GetInfo.pm DBD-mysql-2.9004/lib/DBD/mysql/INSTALL.pod DBD-mysql-2.9004/lib/DBD/mysql.pm DBD-mysql-2.9004/lib/Mysql/ DBD-mysql-2.9004/lib/Mysql/Statement.pm DBD-mysql-2.9004/lib/Bundle/ DBD-mysql-2.9004/lib/Bundle/DBD/ DBD-mysql-2.9004/lib/Bundle/DBD/mysql.pm DBD-mysql-2.9004/lib/Mysql.pm DBD-mysql-2.9004/dbdimp.h DBD-mysql-2.9004/mysql.xs DBD-mysql-2.9004/MANIFEST.SKIP DBD-mysql-2.9004/README DBD-mysql-2.9004/INSTALL.html DBD-mysql-2.9004/META.yml DBD-mysql-2.9004/Makefile.PL DBD-mysql-2.9004/ChangeLog DBD-mysql-2.9004/constants.h DBD-mysql-2.9004/TODO Removing previously used /root/.cpan/build/DBD-mysql-2.9004 CPAN.pm: Going to build R/RU/RUDY/DBD-mysql-2.9004.tar.gz Can't exec "mysql_config": 没有那个文件或目录 at Makefile.PL line 174. readline() on closed filehandle PIPE at Makefile.PL line 176. Can't exec "mysql_config": 没有那个文件或目录 at Makefile.PL line 174. readline() on closed filehandle PIPE at Makefile.PL line 176. Can't exec "mysql_config": 没有那个文件或目录 at Makefile.PL line 174. readline() on closed filehandle PIPE at Makefile.PL line 176. Can't exec "mysql_config": 没有那个文件或目录 at Makefile.PL line 174. readline() on closed filehandle PIPE at Makefile.PL line 176. Can't exec "mysql_config": 没有那个文件或目录 at Makefile.PL line 174. readline() on closed filehandle PIPE at Makefile.PL line 176. Can't exec "mysql_config": 没有那个文件或目录 at Makefile.PL line 174. readline() on closed filehandle PIPE at Makefile.PL line 176. Can't exec "mysql_config": 没有那个文件或目录 at Makefile.PL line 174. readline() on closed filehandle PIPE at Makefile.PL line 176. Can't exec "mysql_config": 没有那个文件或目录 at Makefile.PL line 174. readline() on closed filehandle PIPE at Makefile.PL line 176. Can't exec "mysql_config": 没有那个文件或目录 at Makefile.PL line 174. readline() on closed filehandle PIPE at Makefile.PL line 176. I will use the following settings for compiling and testing: cflags (guessed) = -I/usr/local/mysql/include libs (guessed) = -L/usr/local/mysql/lib -lmysqlclient -lz -lgz nocatchstderr (default) = 0 nofoundrows (default) = 0 ssl (guessed) = 0 testdb (default) = test testhost (default) = testpassword (default) = testuser (default) = To change these settings, see 'perl Makefile.PL --help' and 'perldoc INSTALL'. Checking if your kit is complete... Looks good Note (probably harmless): No library found for -lgz Using DBI 1.47 (for perl 5.008 on i386-linux) installed in /usr/lib/perl5/site_p erl/5.8.0/i386-linux/auto/DBI/ Writing Makefile for DBD::mysql cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod cp lib/Mysql.pm blib/lib/Mysql.pm cp lib/Mysql/Statement.pm blib/lib/Mysql/Statement.pm cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm cc -c -I/usr/lib/perl5/site_perl/5.8.0/i386-linux/auto/DBI/ -I/usr/local/mysql/ include -DDEBUGGING -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS =64 -O2 -g -march=i586 -DVERSION=\"2.9004\" -DXS_VERSION=\"2.9004\" -fPIC "-I/ usr/lib/perl5/5.8.0/i386-linux/CORE" dbdimp.c /usr/bin/perl -p -e "s/~DRIVER~/mysql/g" /usr/lib/perl5/site_perl/5.8.0/i386-lin ux/auto/DBI//Driver.xst > mysql.xsi /usr/bin/perl /usr/lib/perl5/5.8.0/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8. 0/ExtUtils/typemap mysql.xs > mysql.xsc && mv mysql.xsc mysql.c Warning: duplicate function definition 'do' detected in mysql.xs, line 196 Warning: duplicate function definition 'rows' detected in mysql.xs, line 294 cc -c -I/usr/lib/perl5/site_perl/5.8.0/i386-linux/auto/DBI/ -I/usr/local/mysql/ include -DDEBUGGING -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS =64 -O2 -g -march=i586 -DVERSION=\"2.9004\" -DXS_VERSION=\"2.9004\" -fPIC "-I/ usr/lib/perl5/5.8.0/i386-linux/CORE" mysql.c Running Mkbootstrap for DBD::mysql () chmod 644 mysql.bs rm -f blib/arch/auto/DBD/mysql/mysql.so LD_RUN_PATH="/usr/local/mysql/lib:/usr/lib" /usr/bin/perl myld cc -shared -L/us r/local/lib dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.so -L/usr/loca l/mysql/lib -lmysqlclient -lz chmod 755 blib/arch/auto/DBD/mysql/mysql.so cp mysql.bs blib/arch/auto/DBD/mysql/mysql.bs chmod 644 blib/arch/auto/DBD/mysql/mysql.bs Manifying blib/man3/DBD::mysql.3 Manifying blib/man3/Mysql.3 Manifying blib/man3/DBD::mysql::INSTALL.3 Manifying blib/man3/Bundle::DBD::mysql.3 /usr/bin/make -- OK Running make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/00base...........ok t/10dsnlist........DBI connect('test','',...) failed: Access denied for user 'ro ot'@'localhost' (using password: NO) at t/10dsnlist.t line 45 Cannot connect: Access denied for user 'root'@'localhost' (using password: NO) 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: Access denied for user 'ro ot'@'localhost' (using password: NO) at t/20createdrop.t line 45 Cannot connect: Access denied for user 'root'@'localhost' (using password: NO) 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: Access denied for user 'ro ot'@'localhost' (using password: NO) at t/30insertfetch.t line 48 Cannot connect: Access denied for user 'root'@'localhost' (using password: NO) 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: Access denied for user 'ro ot'@'localhost' (using password: NO) at t/40bindparam.t line 64 Cannot connect: Access denied for user 'root'@'localhost' (using password: NO) 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: Access denied for user 'ro ot'@'localhost' (using password: NO) at t/40blobs.t line 68 Cannot connect: Access denied for user 'root'@'localhost' (using password: NO) 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: Access denied for user 'ro ot'@'localhost' (using password: NO) at t/40listfields.t line 57 Cannot connect: Access denied for user 'root'@'localhost' (using password: NO) 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: Access denied for user 'ro ot'@'localhost' (using password: NO) at t/40nulls.t line 50 Cannot connect: Access denied for user 'root'@'localhost' (using password: NO) 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: Access denied for user 'ro ot'@'localhost' (using password: NO) at t/40numrows.t line 59 Cannot connect: Access denied for user 'root'@'localhost' (using password: NO) 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: Access denied for user 'ro ot'@'localhost' (using password: NO) at t/50chopblanks.t line 57 Cannot connect: Access denied for user 'root'@'localhost' (using password: NO) 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: Access denied for user 'ro ot'@'localhost' (using password: NO) 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 insta lled t/ak-dbd...........DBI connect('test','',...) failed: Access denied for user 'ro ot'@'localhost' (using password: NO) at t/ak-dbd.t line 59 t/ak-dbd...........ok 3/90Can'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-90 Failed 88/90 tests, 2.22% okay t/akmisc...........Mysql connect('database=test;host=','',...) failed: Access de nied for user 'root'@'localhost' (using password: NO) at t/akmisc.t line 140 t/akmisc...........NOK 1Cannot connect: Access denied for user 'root'@'localhost ' (using password: NO) 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-351 Failed 351/351 tests, 0.00% okay t/dbdadmin.........DBI connect('test','',...) failed: Access denied for user 'ro ot'@'localhost' (using password: NO) at t/dbdadmin.t line 74 t/dbdadmin.........NOK 1Cannot connect: Access denied for user 'root'@'localhost ' (using password: NO) 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: Access denied for user 'ro ot'@'localhost' (using password: NO) 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: Access de nied for user 'root'@'localhost' (using password: NO) at t/mysql.t line 55 not ok 1: Access denied for user 'root'@'localhost' (using password: NO) 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/mysql............FAILED tests 1-68 Failed 68/68 tests, 0.00% okay t/mysql2...........Mysql connect('database=test;host=','',...) failed: Access de nied for user 'root'@'localhost' (using password: NO) 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 9 100.00% 1-9 t/20createdrop.t 10 2560 5 5 100.00% 1-5 t/30insertfetch.t 10 2560 11 11 100.00% 1-11 t/40bindparam.t 10 2560 28 28 100.00% 1-28 t/40blobs.t 10 2560 11 11 100.00% 1-11 t/40listfields.t 10 2560 18 18 100.00% 1-18 t/40nulls.t 10 2560 11 11 100.00% 1-11 t/40numrows.t 10 2560 25 25 100.00% 1-25 t/50chopblanks.t 10 2560 35 35 100.00% 1-35 t/50commit.t 255 65280 30 30 100.00% 1-30 t/ak-dbd.t 255 65280 90 88 97.78% 1 4-90 t/akmisc.t 10 2560 351 351 100.00% 1-351 t/dbdadmin.t 10 2560 21 21 100.00% 1-21 t/insertid.t 255 65280 12 12 100.00% 1-12 t/mysql.t 68 68 100.00% 1-68 t/mysql2.t 255 65280 ?? ?? % ?? 1 test skipped. Failed 16/18 test scripts, 11.11% okay. 723/730 subtests failed, 0.96% okay. make: *** [test_dynamic] 错误 2 /usr/bin/make test -- NOT OK Running make install make test had returned bad status, won't install without force cpan> q

本文地址:http://com.8s8s.com/it/it22793.htm