Error occurred: install_driver(mysql) failed: Can't load '/usr/lib/perl5/site_perl/5.8.8/i386-linux-

当遇到'install_driver(mysql) failed: Can't load'错误时,通常是由于DBD包未正确编译导致。解决方案是重新编译DBD包。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在遇到类似错误,一般为DBD的包没有编译好,需要重新编译,即可;如:

[root@monitor ~]# mmm_control checks
db2  ping         [last change: 2013/02/27 13:23:58]  OK
db2  mysql        [last change: 2013/02/27 13:23:58]  UNKNOWN: Error occurred: install_driver(mysql) failed: Can't load '/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.18: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm line 230, <STDIN> line 1.
db2  rep_threads  [last change: 2013/02/27 13:23:58]  UNKNOWN: Error occurred: install_driver(mysql) failed: Can't load '/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.18: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm line 230, <STDIN> line 1.
db2  rep_backlog  [last change: 2013/02/27 13:23:58]  UNKNOWN: Error occurred: install_driver(mysql) failed: Can't load '/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.18: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm line 230, <STDIN> line 1.
db1  ping         [last change: 2013/02/27 13:23:58]  OK
db1  mysql        [last change: 2013/02/27 13:23:58]   at (eval 16) line 3
db1  rep_threads  [last change: 2013/02/27 13:23:58]   at (eval 16) line 3
db1  rep_backlog  [last change: 2013/02/27 13:23:58]   at (eval 16) line 3

[root@monitor ~]#
[root@monitor DBD-mysql-4.018]# perl Makefile
Makefile              Makefile.PL           Makefile.PL.embedded
[root@monitor DBD-mysql-4.018]# perl Makefile
Makefile              Makefile.PL           Makefile.PL.embedded
[root@monitor DBD-mysql-4.018]# perl Makefile.PL  --mysql_config=/usr/local/mysq
l/bin/mysql_config 


PLEASE NOTE:

For 'make test' to run properly, you must ensure that the 
database user 'root' can connect to your MySQL server 
and has the proper privileges that these tests require such 
as 'drop table', 'create table', 'drop procedure', 'create procedure'
as well as others. 

mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t';

You can also optionally set the user to run 'make test' with:

perl Makefile.PL --testuser=username

I will use the following settings for compiling and testing:

  cflags        (mysql_config) = -I/usr/local/mysql/include  -g
  embedded      (mysql_config) = 
  libs          (mysql_config) = -L/usr/local/mysql/lib -lmysqlclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl
  mysql_config  (Users choice) = /usr/local/mysql/bin/mysql_config
  nocatchstderr (default     ) = 0
  nofoundrows   (default     ) = 0
  ssl           (guessed     ) = 1
  testdb        (default     ) = test
  testhost      (default     ) = 
  testpassword  (default     ) = 
  testsocket    (default     ) = 
  testuser      (guessed     ) = root

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

Using DBI 1.52 (for perl 5.008008 on i386-linux-thread-multi) installed in /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/DBI/
Writing Makefile for DBD::mysql
[root@monitor DBD-mysql-4.018]# make
gcc -c  -I/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/DBI -I/usr/local/mysql/include  -g -DDBD_MYSQL_WITH_SSL -DDBD_MYSQL_INSERT_ID_IS_GOOD -g  -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables   -DVERSION=\"4.018\" -DXS_VERSION=\"4.018\" -fPIC "-I/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE"   dbdimp.c
dbdimp.c: In function 鈉ount_params?
dbdimp.c:94: warning: suggest parentheses around assignment used as truth value
dbdimp.c:137: warning: suggest parentheses around assignment used as truth value
dbdimp.c: In function 鈊bd_discon_all?
dbdimp.c:2172: warning: unused variable 鈏mp_xxh?
dbdimp.c: In function 鈓ysql_st_prepare?
dbdimp.c:2593: warning: unused variable 鈒imit_flag?
gcc -c  -I/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/DBI -I/usr/local/mysql/include  -g -DDBD_MYSQL_WITH_SSL -DDBD_MYSQL_INSERT_ID_IS_GOOD -g  -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables   -DVERSION=\"4.018\" -DXS_VERSION=\"4.018\" -fPIC "-I/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE"   mysql.c
mysql.xs: In function 釾S_DBD__mysql__db_do?
mysql.xs:242: warning: unused variable 鈙tatement_ptr?
mysql.xs: In function 釾S_DBD__mysql__st_more_results?
mysql.xs:588: warning: implicit declaration of function 鈓ysql_st_next_results?
mysql.xs:587: warning: unused variable 鈘etval?
mysql.xs: In function 釾S_DBD__mysql__GetInfo_dbd_mysql_get_info?
mysql.xs:724: warning: implicit declaration of function 鈏s_prefix?
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
rm -f blib/arch/auto/DBD/mysql/mysql.so
/usr/bin/perl myld gcc  -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -L/usr/local/lib dbdimp.o mysql.o  -o blib/arch/auto/DBD/mysql/mysql.so        \
           -L/usr/local/mysql/lib -lmysqlclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl      \
          
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::DBD::mysql.3pm
[root@monitor DBD-mysql-4.018]# 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 1/6                                           
#   Failed test 'use DBD::mysql;'
#   in t/00base.t at line 21.
#     Tried to use 'DBD::mysql'.
#     Error:  Can't load '/usr/local/DBD-mysql-4.018/blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.18: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm line 230.
#  at (eval 6) line 2
# Compilation failed in require at (eval 6) line 2.
# BEGIN failed--compilation aborted at t/00base.t line 21.
t/00base....................NOK 2FAILED--Further testing stopped: Unable to load DBD::mysql
make: *** [test_dynamic] Error 9
[root@monitor DBD-mysql-4.018]# make install
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Writing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBD/mysql/.packlist
Appending installation info to /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod
[root@monitor DBD-mysql-4.018]# cp /usr/local/mysql
mysql/               mysql-5.5.13/        mysql-5.5.13.tar.gz
[root@monitor DBD-mysql-4.018]# cp /usr/local/mysql/include/my
my_alloc.h       my_getopt.h      mysql_com.h      mysql_version.h
my_attribute.h   my_global.h      mysqld_ername.h  my_sys.h
my_compiler.h    my_list.h        mysqld_error.h   my_xml.h
my_config.h      my_net.h         mysql_embed.h    
my_dbug.h        my_pthread.h     mysql.h          
my_dir.h         mysql/           mysql_time.h     
[root@monitor DBD-mysql-4.018]# cp /usr/local/mysql/include/my
my_alloc.h       my_getopt.h      mysql_com.h      mysql_version.h
my_attribute.h   my_global.h      mysqld_ername.h  my_sys.h
my_compiler.h    my_list.h        mysqld_error.h   my_xml.h
my_config.h      my_net.h         mysql_embed.h    
my_dbug.h        my_pthread.h     mysql.h          
my_dir.h         mysql/           mysql_time.h     
[root@monitor DBD-mysql-4.018]# cp /usr/local/mysql/include/mysql
mysql/           mysqld_ername.h  mysql_embed.h    mysql_time.h
mysql_com.h      mysqld_error.h   mysql.h          mysql_version.h
[root@monitor DBD-mysql-4.018]# cp /usr/local/mysql/include/mysql
mysql/           mysqld_ername.h  mysql_embed.h    mysql_time.h
mysql_com.h      mysqld_error.h   mysql.h          mysql_version.h
[root@monitor DBD-mysql-4.018]# cp /usr/local/mysql/include/mysql
mysql/           mysqld_ername.h  mysql_embed.h    mysql_time.h
mysql_com.h      mysqld_error.h   mysql.h          mysql_version.h
[root@monitor DBD-mysql-4.018]# cp /usr/local/mysql/include/mysql
mysql/           mysqld_ername.h  mysql_embed.h    mysql_time.h
mysql_com.h      mysqld_error.h   mysql.h          mysql_version.h
[root@monitor DBD-mysql-4.018]# cp /usr/local/mysql/include/mysql
mysql/           mysqld_ername.h  mysql_embed.h    mysql_time.h
mysql_com.h      mysqld_error.h   mysql.h          mysql_version.h
[root@monitor DBD-mysql-4.018]# cp /usr/local/mysql/include/mysql*  /usr/include/
cp: omitting directory `/usr/local/mysql/include/mysql'
[root@monitor DBD-mysql-4.018]# cp /usr/local/mysql/include/mysql*  /usr/include/
cp: omitting directory `/usr/local/mysql/include/mysql'
cp: overwrite `/usr/include/mysql_com.h'? y
cp: overwrite `/usr/include/mysqld_ername.h'? y
cp: overwrite `/usr/include/mysqld_error.h'? y
cp: overwrite `/usr/include/mysql_embed.h'? y
cp: overwrite `/usr/include/mysql.h'? y
cp: overwrite `/usr/include/mysql_time.h'? y
cp: overwrite `/usr/include/mysql_version.h'? y
[root@monitor DBD-mysql-4.018]# y
-bash: y: command not found
[root@monitor DBD-mysql-4.018]# cp /usr/local/mysql/lib/* /usr/lib
cp: omitting directory `/usr/local/mysql/lib/plugin'
[root@monitor DBD-mysql-4.018]# mmm_control checks
db2  ping         [last change: 2013/02/27 13:23:58]  OK
db2  mysql        [last change: 2013/02/27 15:05:34]  OK
db2  rep_threads  [last change: 2013/02/27 13:23:58]  ERROR: Replication is broken
db2  rep_backlog  [last change: 2013/02/27 15:05:34]  OK: Backlog is null
db1  ping         [last change: 2013/02/27 13:23:58]  OK
db1  mysql        [last change: 2013/02/27 15:05:34]  OK
db1  rep_threads  [last change: 2013/02/27 13:23:58]  ERROR: Replication is not set up
db1  rep_backlog  [last change: 2013/02/27 13:23:58]  ERROR: Replication is not set up

[root@monitor DBD-mysql-4.018]#



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值