这篇文章主要介绍“mysql执行执行pt-query-digest报错的原因”,在日常操作中,相信很多人在mysql执行执行pt-query-digest报错的原因问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”mysql执行执行pt-query-digest报错的原因”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
操作环境
问题
分析问题
操作系统版本
[root@three57 mysql57_dir]# more /etc/redhat-release Red Hat Enterprise Linux Server release 6.8 (Santiago)
pt-query-digest版本
[root@three57 mysql57_dir]# pt-query-digest --version pt-query-digest 3.1.0
执行pt-query-digest报错
[root@three57 percona-toolkit-3.1.0]# pt-query-digest --interval=2 --processlist -uroot -psystem Reading from STDIN ... install_driver(mysql) failed: Attempt to reload DBD/mysql.pm aborted. Compilation failed in require at (eval 23) line 3.
经查baidu与perl的mysql.so库文件相关
[root@three57 percona-toolkit-3.1.0]# locate mysql.so /usr/lib64/perl5/auto/DBD/mysql/mysql.so
分析perl的mysql.so库文件的依赖库是否完整,可见缺失libmysqlclient.so.16
[root@three57 percona-toolkit-3.1.0]# ldd /usr/lib64/perl5/auto/DBD/mysql/mysql.so linux-vdso.so.1 => (0x00007ffcf6dd4000) libmysqlclient.so.16 => not found 确实没找到mysql动态链接库 libz.so.1 => /lib64/libz.so.1 (0x00007f9b0e1cb000) libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f9b0df94000) libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f9b0dd7b000) libm.so.6 => /lib64/libm.so.6 (0x00007f9b0daf6000) libssl.so.10 => /usr/lib64/libssl.so.10 (0x00007f9b0d88a000) libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007f9b0d4a6000) libc.so.6 => /lib64/libc.so.6 (0x00007f9b0d111000) libfreebl3.so => /lib64/libfreebl3.so (0x00007f9b0cf0e000) libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f9b0ccca000) libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f9b0c9e2000) libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f9b0c7de000) libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f9b0c5b2000) libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f9b0c397000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f9b0c193000) /lib64/ld-linux-x86-64.so.2 (0x000000381da00000) libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f9b0bf88000) libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f9b0bd84000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f9b0bb67000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f9b0b947000)
libmysqlclient.so这种库文件源于mysql安装介质
查询已安装的mysql软件包
[root@three57 mysql57_dir]# rpm -qa|grep -i --color mysql mysql-community-common-5.7.21-1.el6.x86_64 mysql-community-server-5.7.21-1.el6.x86_64 perl-DBD-MySQL-4.013-3.el6.x86_64 mysql-community-libs-5.7.21-1.el6.x86_64 mysql-community-client-5.7.21-1.el6.x86_64
查询已安装的libmysqlclient库文件
[root@three57 mysql57_dir]# locate /usr/lib64/mysql/libmysqlclient.so.20 /usr/lib64/mysql/libmysqlclient.so.20 /usr/lib64/mysql/libmysqlclient.so.20.3.8
综上所述,应该需要安装mysql软件包mysql-community-libs-compat
(注:它是提供mysql旧版本的共享库文件)
[root@three57 mysql57_dir]# rpm -ivh mysql-community-libs-compat-5.7.21-1.el6.x86_64.rpm warning: mysql-community-libs-compat-5.7.21-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-libs-co########################################### [100%] [root@three57 mysql57_dir]# locate libmysqlclient.so.16 /usr/lib64/mysql/libmysqlclient.so.16 /usr/lib64/mysql/libmysqlclient.so.16.0.0
执行ldd /usr/lib64/perl5/auto/DBD/mysql/mysql.so正常
[root@three57 mysql57_dir]# ldd /usr/lib64/perl5/auto/DBD/mysql/mysql.so linux-vdso.so.1 => (0x00007ffd3fee9000) libmysqlclient.so.16 => /usr/lib64/mysql/libmysqlclient.so.16 (0x00007f346d4e3000) libz.so.1 => /lib64/libz.so.1 (0x00007f346d2cd000) libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f346d095000) libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f346ce7c000) libm.so.6 => /lib64/libm.so.6 (0x00007f346cbf8000) libssl.so.10 => /usr/lib64/libssl.so.10 (0x00007f346c98b000) libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007f346c5a7000) libc.so.6 => /lib64/libc.so.6 (0x00007f346c213000) libfreebl3.so => /lib64/libfreebl3.so (0x00007f346c00f000) libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f346bdcb000) libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f346bae4000) libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f346b8df000) libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f346b6b3000) libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f346b499000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f346b294000) /lib64/ld-linux-x86-64.so.2 (0x000000381da00000) libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f346b089000) libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f346ae86000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f346ac68000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f346aa49000)
到此,关于“mysql执行执行pt-query-digest报错的原因”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。