我在Linux RHEL上安装了Perl: perl -v
This is perl 5, version 12, subversion 2 (v5.12.2) built for x86_64-linux-thread-multi
当我运行命令以查看安装的Perl模块时:
find `perl -e 'print "@INC"'` -name '*.pm' -print
我可以看到DBI:
/mu/sdk/perl/5.12.2-gcc443-rhel5-64/lib/DBI/DBD/Metadata.pm
/mu/sdk/perl/5.12.2-gcc443-rhel5-64/lib/DBI/DBD/SqlEngine.pm
/mu/sdk/perl/5.12.2-gcc443-rhel5-64/lib/DBD/mysql/GetInfo.pm
/mu/sdk/perl/5.12.2-gcc443-rhel5-64/lib/DBD/mysql.pm
/mu/sdk/perl/5.12.2-gcc443-rhel5-64/lib/Bundle/DBD/mysql.pm
安装并运行MySQL:
Server version: 5.6.26 MySQL Community Server (GPL)
我在Perl脚本中有两行代码:
use DBI;
my $dbh = DBI->connect("DBI:mysql:database=test;host=localhost","root", "pass");
我看到的错误是:
$ perl mysql.pl
install_driver(mysql) failed: Can't load '/mu/sdk/perl/5.12.2-gcc443-rhel5-64/lib/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.15: cannot open shared object file: No such file or directory at /mu/apps/perl/5.12.2-gcc443-rhel5-64/lib/DynaLoader.pm line 200.
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 mysql.pl line 2
$
我用YUM验证了:
$ sudo yum install perl-DBD-MySQL
Setting up Install Process
Package perl-DBD-MySQL-4.013-3.el6.x86_64 already installed and latest version
Nothing to do
$
这是/ usr / lib64 / mysql的列表:
$ pwd
/usr/lib64/mysql
$ ls -lrth
/usr/lib64/mysql
total 14M
-rwxr-xr-x 1 root root 8.6M Jul 14 17:47 libmysqlclient.so.18.1.0*
-rwxr-xr-x 1 root root 2.7M Jul 14 17:49 libmysqlclient.so.16.0.0*
-rwxr-xr-x 1 root root 2.7M Jul 14 17:49 libmysqlclient_r.so.16.0.0*
lrwxrwxrwx 1 root root 24 Jul 27 18:23 libmysqlclient.so.18 -> libmysqlclient.so.18.1.0*
lrwxrwxrwx 1 root root 24 Jul 27 18:23 libmysqlclient_r.so.18.1.0 -> libmysqlclient.so.18.1.0*
lrwxrwxrwx 1 root root 20 Jul 27 18:23 libmysqlclient_r.so.18 -> libmysqlclient.so.18*
lrwxrwxrwx 1 root root 24 Jul 27 18:23 libmysqlclient.so.16 -> libmysqlclient.so.16.0.0*
lrwxrwxrwx 1 root root 26 Jul 27 18:23 libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0*
drwxr-xr-x 3 root root 4.0K Jul 27 18:23 plugin/
$
接下来我该怎么办? 如何配置这个有问题的(libmysqlclient.so.15)还是有其他一些问题?