Chinaunix
标题:
求助:perl如何连接mysql数据库?
[打印本页]
作者:
yzcdf
时间:
2005-07-27 17:26
标题:
求助:perl如何连接mysql数据库?
请问用perl连接mysql有几种方式?
我找到了用DBI的方式,
前面
安装DBI包(DBI-1.48)
安装Data-ShowTable包(Data-ShowTable-3.3)
都过去了
到安装Msql-Mysql-modules-1.2219包的时候就怎么也编译不过去
perl Makefile.PL后,出现下面的代码
Which drivers do you want to install?
1) MySQL only
2) mSQL only (either of mSQL 1 or mSQL 2)
3) MySQL and mSQL (either of mSQL 1 or mSQL 2)
4) mSQL 1 and mSQL 2
5) MySQL, mSQL 1 and mSQL 2
Enter the appropriate number: [3]
复制代码
它默认的是3,我想改成1,好像不起作用
这个以后的所有询问都是默认的,包括连接数据库的用户名和密码
一路确定后,执行make命令,到最后就报错,我把代码帖出来
希望大家帮我一下
[root@MagicLinux Msql-Mysql-modules-1.2219]# perl Makefile.PL
Which drivers do you want to install?
1) MySQL only
2) mSQL only (either of mSQL 1 or mSQL 2)
3) MySQL and mSQL (either of mSQL 1 or mSQL 2)
4) mSQL 1 and mSQL 2
5) MySQL, mSQL 1 and mSQL 2
Enter the appropriate number: [3] 1
Do you want to install the MysqlPerl emulation? You might keep your old
Mysql module (to be distinguished from DBD::mysql!) if you are concerned
about compatibility to existing applications! [n] y
Where is your MySQL installed? Please tell me the directory that
contains the subdir 'include'. [/usr/local/mysql]
Which database should I use for testing the MySQL drivers? [test]
On which host is database test running (hostname, ip address
or host:port) [localhost]
User name for connecting to database test? [undef] root
Password for connecting to database test? [undef]
Creating files for MySQL ..........................
WARNING: PL_FILES takes a hash reference not a array reference.
Please inform the author.
Checking if your kit is complete...
Looks good
Note (probably harmless): No library found for -lgz
Using DBI 1.48 (for perl 5.008005 on i386-linux-thread-multi) installed in /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBI/
Writing Makefile for DBD::mysql
Writing Makefile for Msql-Mysql-modules
[root@MagicLinux Msql-Mysql-modules-1.2219]# make
/usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/lib/perl5/5.8.5/i386-linux-thread-multi \
-I/usr/lib/perl5/5.8.5 -Ilib -MExtUtils::PerlPP \
-e ppp "dbd/dbimon.in" "dbimon" "lib/DBD/mysql/Install/Config.pm"
/usr/bin/pod2text mysql/lib/DBD/mysql.pm >;README
make[1]: Entering directory `/mnt/hda11/webserver/msql_mysql_modules/Msql-Mysql-modules-1.2219/mysql'
cp lib/DBD/mysql.pm ../blib/lib/DBD/mysql.pm
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
gcc -c -I/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBI -I/usr/local/mysql/include -I../dbd -I/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBI -I/usr/lib/perl5/5.8.5/i386-linux-thread-multi -D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -march=i686 -DVERSION=\"2.0419\" -DXS_VERSION=\"2.0419\" -fPIC "-I/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE" -DDBD_MYSQL dbdimp.c
dbdimp.c: In function `mysql_db_login':
dbdimp.c:724: warning: passing arg 3 of `mysql_dr_error' discards qualifiers from pointer target type
dbdimp.c: In function `mysql_db_FETCH_attrib':
dbdimp.c:1013: warning: initialization discards qualifiers from pointer target type
dbdimp.c:1019: warning: initialization discards qualifiers from pointer target type
dbdimp.c:1027: warning: initialization discards qualifiers from pointer target type
dbdimp.c:1048: warning: initialization discards qualifiers from pointer target type
dbdimp.c:1059: warning: initialization discards qualifiers from pointer target type
dbdimp.c: In function `mysql_st_internal_execute':
dbdimp.c:1203: warning: passing arg 3 of `mysql_dr_error' discards qualifiers from pointer target type
dbdimp.c:1264: warning: passing arg 3 of `mysql_dr_error' discards qualifiers from pointer target type
dbdimp.c: In function `mysql_st_fetch':
dbdimp.c:1427: warning: passing arg 3 of `mysql_dr_error' discards qualifiers from pointer target type
dbdimp.c: In function `MysqlReconnect':
dbdimp.c:2163: warning: passing arg 3 of `mysql_dr_error' discards qualifiers from pointer target type
/usr/bin/perl -p -e "s/~DRIVER~/mysql/g" /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBI//Driver.xst >; mysql.xsi
/usr/bin/perl /usr/lib/perl5/5.8.5/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.5/ExtUtils/typemap mysql.xs >; mysql.xsc && mv mysql.xsc mysql.c
Warning: duplicate function definition 'do' detected in mysql.xs, line 281
Warning: duplicate function definition 'rows' detected in mysql.xs, line 407
gcc -c -I/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBI -I/usr/local/mysql/include -I../dbd -I/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBI -I/usr/lib/perl5/5.8.5/i386-linux-thread-multi -D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -march=i686 -DVERSION=\"2.0419\" -DXS_VERSION=\"2.0419\" -fPIC "-I/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE" -DDBD_MYSQL mysql.c
mysql.xs: In function `XS_DBD__mysql__dr__ListDBs':
mysql.xs:98: warning: passing arg 3 of `mysql_dr_error' discards qualifiers from pointer target type
mysql.xs: In function `XS_DBD__mysql__dr__admin_internal':
mysql.xs:138: warning: passing arg 3 of `mysql_dr_error' discards qualifiers from pointer target type
mysql.xs:144: error: too few arguments to function `mysql_shutdown'
mysql.xs:186: warning: passing arg 3 of `mysql_dr_error' discards qualifiers from pointer target type
mysql.xs: In function `XS_DBD__mysql__db__ListDBs':
mysql.xs:250: warning: passing arg 3 of `mysql_dr_error' discards qualifiers from pointer target type
mysql.xs: In function `XS_DBD__mysql__db__ListTables':
mysql.xs:271: warning: passing arg 3 of `mysql_dr_error' discards qualifiers from pointer target type
make[1]: *** [mysql.o] 错误 1
make[1]: Leaving directory `/mnt/hda11/webserver/msql_mysql_modules/Msql-Mysql-modules-1.2219/mysql'
make: *** [subdirs] 错误 2
复制代码
先谢谢了~~
作者:
deathcult
时间:
2005-07-28 14:39
标题:
求助:perl如何连接mysql数据库?
装DBI
然后DBD::mysql。
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2