libmysqlclient.so.16: cannot open shared object file: No such file or directory

散盡浮華發表於2018-07-27

 

編譯安裝的mysql5.6.39,安裝目錄是/usr/local/mysql,啟用程式時報錯:libmysqlclient.so.16: cannot open shared object file: No such file or directory。檢查mysql的.so庫檔案,發現有libmysqlclient.so.18,而程式啟用依賴的mysql庫檔案是libmysqlclient.so.16。解決辦法:

解決思路:
使用yum安裝mysql,然後啟用libmysqlclient.so.16的庫檔案!

解決過程:
[root@back-server ~]# ldconfig -v |grep mysql
ldconfig: /etc/ld.so.conf.d/kernel-2.6.32-696.el6.x86_64.conf:6: duplicate hwcap 1 nosegneg
ldconfig: Can't open directory /usr/local/lib/libpcre.so.1: Not a directory
/usr/local/mysql/lib:
        libmysqlclient.so.18 -> libmysqlclient_r.so.18.1.0
        libauthmysql.so -> libauthmysql.so.0


[root@back-server ~]# ll /usr/local/mysql/lib/
total 236124
-rw-r--r-- 1 mysql mysql  19528338 Jul 27 11:52 libmysqlclient.a
lrwxrwxrwx 1 mysql mysql        16 Jul 27 11:55 libmysqlclient_r.a -> libmysqlclient.a
lrwxrwxrwx 1 mysql mysql        17 Jul 27 11:55 libmysqlclient_r.so -> libmysqlclient.so
lrwxrwxrwx 1 mysql mysql        20 Jul 27 11:55 libmysqlclient_r.so.18 -> libmysqlclient.so.18
lrwxrwxrwx 1 mysql mysql        24 Jul 27 11:55 libmysqlclient_r.so.18.1.0 -> libmysqlclient.so.18.1.0
lrwxrwxrwx 1 mysql mysql        20 Jul 27 11:55 libmysqlclient.so -> libmysqlclient.so.18
lrwxrwxrwx 1 mysql mysql        24 Jul 27 11:55 libmysqlclient.so.18 -> libmysqlclient.so.18.1.0
-rwxr-xr-x 1 mysql mysql   8864941 Jul 27 11:52 libmysqlclient.so.18.1.0
-rw-r--r-- 1 mysql mysql 213370914 Jul 27 11:55 libmysqld.a
-rw-r--r-- 1 mysql mysql     14270 Jul 27 11:51 libmysqlservices.a
drwxr-xr-x 3 mysql mysql      4096 Jul 27 11:55 plugin

[root@back-server ~]# cat /etc/ld.so.conf
......
/usr/loca/mysql/lib

現在使用yum安裝mysql
[root@back-server ~]# yum install -y mysql
[root@back-server ~]# ldconfig -v |grep mysql
ldconfig: /etc/ld.so.conf.d/kernel-2.6.32-696.el6.x86_64.conf:6: duplicate hwcap 1 nosegneg
ldconfig: Can't open directory /usr/local/lib/libpcre.so.1: Not a directory
/usr/lib64/mysql:
        libmysqlclient.so.16 -> libmysqlclient.so.16.0.0
        libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0
/usr/local/mysql/lib:
        libmysqlclient.so.18 -> libmysqlclient_r.so.18.1.0
        libauthmysql.so -> libauthmysql.so.0

啟用libmysqlclient.so.16庫檔案
[root@back-server ~]# cat /etc/ld.so.conf
.....
/usr/lib64/mysql
[root@back-server ~]# ldconfig 

再次檢視
[root@back-server ~]# ldconfig -v |grep mysql
ldconfig: /etc/ld.so.conf.d/kernel-2.6.32-696.el6.x86_64.conf:6: duplicate hwcap 1 nosegneg
ldconfig: Can't open directory /usr/local/lib/libpcre.so.1: Not a directory
/usr/lib64/mysql:
        libmysqlclient.so.16 -> libmysqlclient.so.16.0.0
        libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0

相關文章