Failed to connect to MySQL server as DBD::mysql module is not installed 问题的解决

时间:2020-11-30 10:52:58

部署PXC ,卸了旧的MySQL

perl-DBD-MySQL-4.013-3.el6.x86_64 这个包已经安装了,innobackup时一直在报错:

Failed to connect to MySQL server as DBD::mysql module is not installed at - line 1327.

查看DBD mysql.so依赖的lib库 :

[root@pxc_node0_172.16.11.127 ~]# ldd /usr/local/lib64/perl5/auto/DBD/mysql/mysql.so
linux-vdso.so.1 => (0x00007fffa91f6000)
libperconaserverclient.so.18 => not found
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd50fe5f000)
libm.so.6 => /lib64/libm.so.6 (0x00007fd50fbdb000)
librt.so.1 => /lib64/librt.so.1 (0x00007fd50f9d3000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fd50f7ce000)
libc.so.6 => /lib64/libc.so.6 (0x00007fd50f43a000)

libperconaserverclient.so.18这个so文件找不到了

从旧的MySQL lib 拷贝一个:

[root@pxc_node0_172.16.11.127 lib]# cd /usr/lib64/mysql
[root@pxc_node0_172.16.11.127 mysql]# ll
total 6764
lrwxrwxrwx 1 root root 32 Sep 13 09:11 libmysqlclient.so.18 -> libperconaserverclient.so.18.0.0
lrwxrwxrwx 1 root root 32 Sep 13 09:11 libperconaserverclient.so.18 -> libperconaserverclient.so.18.0.0
-rwxr-xr-x 1 root root 3740215 Sep 13 09:10 libperconaserverclient.so.18.0.0

ldconfig -p 能找到就行:

[root@pxc_node0_172.16.11.127 ~]# ldconfig -p | grep libperconaserverclient
libperconaserverclient.so.18 (libc6,x86-64) => /usr/lib64/mysql/libperconaserverclient.so.18