分类: LINUX
2011-04-05 19:37:34
在用perl连接数据库的时候出现错误,参考下:
写了一个备份程序,BackupMasterDB.pl ,执行时报如下错误:
install_driver(mysql) failed: Can't load
'/usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi/auto/DBD/mysql/mysql.so'
for module DBD::mysql: libmysqlclient.so.15 无法打开共享对象文件: 没有那个文件或目录 at
/usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/DynaLoader.pm line 230.
at (eval 3) line 3
Compilation failed in require at (eval 3) line 3.
Perhaps a required shared library or dll isn't installed where expected
at /home/admin/local/BackupMasterDB.pl line 51
上面错误一看是找不到libmysqlclient.so.15 ,先find吧
# find /usr/ -name "libmysqlclient.so*"
/usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0
/usr/local/mysql/lib/mysql/libmysqlclient.so.15
/usr/local/mysql/lib/mysql/libmysqlclient.so
解决方法:
echo "/usr/local/mysql/lib/mysql/" >> /etc/ld.so.conf
ldconfig
完成