error while loading shared libraries: libmysqlclient.so.20解决办法

安装好sysbench后,试着打开时出错:

[root@qht134 sysbench-master]# /usr/local/sysbench/bin/sysbench --version
/usr/local/sysbench/bin/sysbench: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory

字面意思就是打不到共享库文件libmysqlclient.so.20.

先查找一下本地有没有这个文件:

[root@qht134 /]# find .  -name 'libmysqlclient*'                                                 ./usr/lib64/mysql/libmysqlclient.so.16
./usr/lib64/mysql/libmysqlclient.so.16.0.0
./usr/lib64/mysql/libmysqlclient_r.so.16
./usr/lib64/mysql/libmysqlclient_r.so.16.0.0
./usr/local/mysql/lib/libmysqlclient.so.20
./usr/local/mysql/lib/libmysqlclient.so.20.3.8
./usr/local/mysql/lib/libmysqlclient.a
./usr/local/mysql/lib/libmysqlclient.so

在/usr/loca/mysql/lib下面有这个文件,解决方法是先建立一个软链接到/usr/local/lib

[root@qht134 /]# ln -s /usr/local/mysql/lib/libmysqlclient.so.20 /usr/local/lib/libmysqlclient.so.20

接着在/etc/ld.so.cnf中加入/usr/loca/lib这一行

[root@qht134 /]# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib

执行ldconfig -v更新下配置就可以了

[root@qht134 /]# /sbin/ldconfig -v 

现在sysbench可以执行了!

[root@qht134 /]# /usr/local/sysbench/bin/sysbench --version
sysbench 1.1.0


参考:https://blog.csdn.net/zhanjianshinian/article/details/43964361



已标记关键词 清除标记
©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页