perl连接mysql数据库的问题

我也是装的mysql的rpm包,包括3个文件,server、client和shared libraries.官方站点http://dev.mysql.com/downloads/m ... hel5-x86-32bit-rpms都有下载。我觉得是你安装mysql的时候没装全。
兄弟,装的怎么样了,我也遇到了同样的问题!

想请教一下啊!
linux安装软件就是垃圾, tar.gz相关的包,下载的官网又不说哪些是依赖包,装完后一大堆ERROR


目前我的情况和你一样.

DBI-1.604.tar.gz
DBD-mysql-4.006.tar.gz
mysql-5.1.22-rc-linux-i686-icc-glibc23.tar.gz

perl版本,RHEL AS4 U5系统附带的

[root@uni-linux mytop-1.6]# rpm -qa | grep perl
perl-5.8.5-36.RHEL4
perl-URI-1.30-4
perl-DateManip-5.42a-3
perl-libwww-perl-5.79-5
perl-XML-Encoding-1.01-26
perl-Time-HiRes-1.55-3
perl-XML-NamespaceSupport-1.08-6
perl-XML-Twig-3.13-6
perl-XML-LibXML-1.58-1
perl-Filter-1.30-6
perl-DBI-1.40-8
perl-HTML-Tagset-3.03-30
perl-Parse-Yapp-1.05-32
perl-XML-Parser-2.34-5
perl-XML-Dumper-0.71-2
perl-libxml-enno-1.02-31
perl-Digest-SHA1-2.07-5
perl-Net-DNS-0.48-1
perl-Convert-ASN1-0.18-3
perl-XML-Grove-0.46alpha-27
perl-LDAP-0.31-5
perl-XML-LibXML-Common-0.13-7
perl-DBD-MySQL-2.9004-3.1
perl-HTML-Parser-3.35-6
perl-libxml-perl-0.07-30
perl-Digest-HMAC-1.01-13
perl-XML-SAX-0.12-7
perl-Crypt-SSLeay-0.51-5



QUOTE:
原帖由 xlwang_0903 于 2008-4-10 11:49 发表
我也是装的mysql的rpm包,包括3个文件,server、client和shared libraries.官方站点http://dev.mysql.com/downloads/m ... hel5-x86-32bit-rpms都有下载。我觉得是你安装mysql的时候没装全。

perl连接MySQL时,一定要安装MYSQL的client?

mytop: symbol lookup error: /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/mysql/mysql.so: undefined symbol: DBIc_TRACE_LEVEL

对这个错误,网站都说是DBI和DBD-mysql版本的问题

见: http://blog.donews.com/chnl/archive/2007/07/10/1185067.aspx
刚刚用CPAN安装了DBI和DBD::mysql这两个模块,都成功了,很顺利

问题是程序运行起来还是出错,无奈了!

错误信息如下:

symbol lookup error:
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/mysql.so:
undefined symbol: DBIc_TRACE_LEVEL
终于可以了,,,,

用到包的版本如下:

DBI-1.604.tar.gz
TermReadKey-2.30.tar.gz
DBD-mysql-4.006.tar.gz

我猜想估计是原来用不同版本的DBI,DBD-mysql进行make/make install后,在你原来tar后的文件夹生成一些文件,然后我就把原来tar出来DBI,DBD-mysql的文件夹删了,重装来过一次就OK了

如下:

[root@uni-linux mytop-1.6]# tar -zxvf /home/DBD-mysql-4.006.tar.gz -C /opt DBD-mysql-4.006/
DBD-mysql-4.006/ChangeLog
DBD-mysql-4.006/constants.h
DBD-mysql-4.006/dbdimp.c
DBD-mysql-4.006/dbdimp.h
DBD-mysql-4.006/eg/
DBD-mysql-4.006/eg/._bug14979.pl
DBD-mysql-4.006/eg/bug14979.pl
DBD-mysql-4.006/eg/._bug21028.pl
DBD-mysql-4.006/eg/bug21028.pl
DBD-mysql-4.006/eg/bug30033.pl
DBD-mysql-4.006/eg/bug30033pg.pl
DBD-mysql-4.006/eg/decimal_test.pl
DBD-mysql-4.006/eg/issue21946.pl
DBD-mysql-4.006/eg/prepare_memory_usage.pl
DBD-mysql-4.006/eg/proc_example1.pl
DBD-mysql-4.006/eg/proc_example2.pl
DBD-mysql-4.006/eg/proc_example2a.pl
DBD-mysql-4.006/eg/proc_example2b.pl
DBD-mysql-4.006/eg/proc_example3.pl
DBD-mysql-4.006/eg/proc_example4.pl
DBD-mysql-4.006/INSTALL.html
DBD-mysql-4.006/lib/
DBD-mysql-4.006/lib/Bundle/
DBD-mysql-4.006/lib/Bundle/DBD/
DBD-mysql-4.006/lib/Bundle/DBD/mysql.pm
DBD-mysql-4.006/lib/DBD/
DBD-mysql-4.006/lib/DBD/mysql/
DBD-mysql-4.006/lib/DBD/mysql/GetInfo.pm
DBD-mysql-4.006/lib/DBD/mysql/INSTALL.pod
DBD-mysql-4.006/lib/DBD/mysql.pm
DBD-mysql-4.006/Makefile.PL
DBD-mysql-4.006/Makefile.PL.embedded
DBD-mysql-4.006/MANIFEST
DBD-mysql-4.006/MANIFEST.SKIP
DBD-mysql-4.006/META.yml
DBD-mysql-4.006/myld
DBD-mysql-4.006/mysql.xs
DBD-mysql-4.006/README
DBD-mysql-4.006/t/
DBD-mysql-4.006/t/00base.t
DBD-mysql-4.006/t/10connect.t
DBD-mysql-4.006/t/20createdrop.t
DBD-mysql-4.006/t/25lockunlock.t
DBD-mysql-4.006/t/30insertfetch.t
DBD-mysql-4.006/t/35limit.t
DBD-mysql-4.006/t/35prepare.t
DBD-mysql-4.006/t/40bindparam.t
DBD-mysql-4.006/t/40bindparam2.t
DBD-mysql-4.006/t/40blobs.t
DBD-mysql-4.006/t/40catalog.t
DBD-mysql-4.006/t/40keyinfo.t
DBD-mysql-4.006/t/40listfields.t
DBD-mysql-4.006/t/40nulls.t
DBD-mysql-4.006/t/40numrows.t
DBD-mysql-4.006/t/40server_prepare.t
DBD-mysql-4.006/t/40types.t
DBD-mysql-4.006/t/41bindparam.t
DBD-mysql-4.006/t/41blobs_prepare.t
DBD-mysql-4.006/t/42bindparam.t
DBD-mysql-4.006/t/50chopblanks.t
DBD-mysql-4.006/t/50commit.t
DBD-mysql-4.006/t/60leaks.t
DBD-mysql-4.006/t/65types.t
DBD-mysql-4.006/t/70takeimp.t
DBD-mysql-4.006/t/75supported_sql.t
DBD-mysql-4.006/t/80procs.t
DBD-mysql-4.006/t/insertid.t
DBD-mysql-4.006/t/lib.pl
DBD-mysql-4.006/t/multi_statement.t
DBD-mysql-4.006/t/mysql.dbtest
DBD-mysql-4.006/t/param_values.t
DBD-mysql-4.006/t/prepare_noerror.t
DBD-mysql-4.006/t/test.pl
DBD-mysql-4.006/t/test_data.txt
DBD-mysql-4.006/t/texecute.t
DBD-mysql-4.006/t/utf8.t
DBD-mysql-4.006/t/warnings.t
DBD-mysql-4.006/TODO
[root@uni-linux mytop-1.6]# cd /opt/DBD-mysql-4.006
[root@uni-linux DBD-mysql-4.006]# perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config
I will use the following settings for compiling and testing:

  cflags        (mysql_config) = -I/usr/local/mysql/include
  embedded      (mysql_config) =
  libs          (mysql_config) = -L/usr/local/mysql/lib -lmysqlclient -lz -lcrypt -lnsl -lm
  mysql_config  (Users choice) = /usr/local/mysql/bin/mysql_config
  nocatchstderr (default     ) = 0
  nofoundrows   (default     ) = 0
  ssl           (guessed     ) = 0
  testdb        (default     ) = test
  testhost      (default     ) =
  testpassword  (default     ) =
  testsocket    (default     ) =
  testuser      (default     ) =

To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.

Multiple copies of Driver.xst found in: /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBI/ /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBI/ at Makefile.PL line 739
Using DBI 1.604 (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
[root@uni-linux DBD-mysql-4.006]# make
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
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 -DDBD_MYSQL_INSERT_ID_IS_GOOD -g  -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 -m32 -march=i386 -mtune=pentium4   -DVERSION=\"4.006\" -DXS_VERSION=\"4.006\" -fPIC "-I/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE"   dbdimp.c
/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 225
Warning: duplicate function definition 'rows' detected in mysql.xs, line 612
gcc -c  -I/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBI -I/usr/local/mysql/include -DDBD_MYSQL_INSERT_ID_IS_GOOD -g  -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 -m32 -march=i386 -mtune=pentium4   -DVERSION=\"4.006\" -DXS_VERSION=\"4.006\" -fPIC "-I/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE"   mysql.c
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
rm -f blib/arch/auto/DBD/mysql/mysql.so
/usr/bin/perl myld gcc  -shared -L/usr/local/lib dbdimp.o mysql.o  -o blib/arch/auto/DBD/mysql/mysql.so   -L/usr/local/mysql/lib -lmysqlclient -lz -lcrypt -lnsl -lm
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.3pm
Manifying blib/man3/DBD::mysql::INSTALL.3pm
Manifying blib/man3/Bundle:BD::mysql.3pm
[root@uni-linux DBD-mysql-4.006]# make install
Installing /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/mysql/mysql.so
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Writing /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/mysql/.packlist
Appending installation info to /usr/lib/perl5/5.8.5/i386-linux-thread-multi/perllocal.pod
[root@uni-linux DBD-mysql-4.006]# cd /opt/mytop-1.6
[root@uni-linux mytop-1.6]# perl Makefile.PL
Writing Makefile for mytop
[root@uni-linux mytop-1.6]# make
cp mytop blib/script/mytop
/usr/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/mytop
Manifying blib/man1/mytop.1
[root@uni-linux mytop-1.6]# make install
Writing /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/mytop/.packlist
Appending installation info to /usr/lib/perl5/5.8.5/i386-linux-thread-multi/perllocal.pod
[root@uni-linux mytop-1.6]# mytop -u root -p justin -P 3308

MySQL on localhost (5.1.22-rc-log)                      up 0+06:43:13 [17:35:41] Queries: 3.0    qps:    0 Slow:     0.0         Se/In/Up/De(%):    00/00/00/00

Key Efficiency: 100.0%  Bps in/out:   0.0/  0.3

      Id      User         Host/IP         DB      Time    Cmd Query or State
      --      ----         -------         --      ----    --- ----------
       1      root       localhost       test         0  Query show full process















MySQL on localhost (5.1.22-rc-log)                      up 0+06:43:18 [17:35:46] Queries: 5.0    qps:    0 Slow:     0.0         Se/In/Up/De(%):    00/00/00/00
             qps now:    0 Slow qps: 0.0  Threads:    1 (   1/   0) 00/00/00/00
Key Efficiency: 100.0%  Bps in/out:   0.0/  0.3   Now in/out:   8.0/ 61.3

      Id      User         Host/IP         DB      Time    Cmd Query or State
      --      ----         -------         --      ----    --- ----------
       1      root       localhost       test         0  Query show full process















MySQL on localhost (5.1.22-rc-log)                      up 0+06:43:22 [17:35:50] Queries: 7.0    qps:    0 Slow:     0.0         Se/In/Up/De(%):    00/00/00/00
             qps now:    0 Slow qps: 0.0  Threads:    1 (   1/   0) 00/00/00/00
Key Efficiency: 100.0%  Bps in/out:   0.0/  0.4   Now in/out:   9.5/ 72.4

      Id      User         Host/IP         DB      Time    Cmd Query or State
      --      ----         -------         --      ----    --- ----------
       1      root       localhost       test         0  Query show full process















MySQL on localhost (5.1.22-rc-log)                      up 0+06:43:24 [17:35:52] Queries: 9.0    qps:    0 Slow:     0.0         Se/In/Up/De(%):    00/00/00/00
             qps now:    1 Slow qps: 0.0  Threads:    1 (   1/   0) 00/00/00/00
Key Efficiency: 100.0%  Bps in/out:   0.0/  0.4   Now in/out:  30.1/229.1

      Id      User         Host/IP         DB      Time    Cmd Query or State
      --      ----         -------         --      ----    --- ----------
       1      root       localhost       test         0  Query show full process
[root@uni-linux mytop-1.6]#



最后奇怪,mytop官方说.不适合MySQL5.0,我这边是可以的,呵呵



DBI:1.604
DBD::mysql:4.006
我也看了不少关于版本的评论,但是这2个版本好像已经都是最新的了!
楼上,解决了..................最后再感慨下linux下源码安装~
说说怎么解决的阿?