Postfix

後綴:載入共享庫時出錯:libmysqlclient.so.16

  • May 3, 2016

後綴:載入共享庫時出錯:libmysqlclient.so.16:無法打開共享對象文件:沒有這樣的文件或目錄

[root@localhost ~]# mysql -uroot -p*** -e "select version();"
Warning: Using a password on the command line interface can be insecure.
+-----------+
| version() |
+-----------+
| 5.6.29    |
+-----------+

[root@localhost ~]# cat /etc/redhat-release 
CentOS release 6.7 (Final)

[root@localhost ~]# rpm -qa postfix
postfix-2.6.6-6.el6_7.1.x86_64

安裝 Zabbix 2.4.7 後,我無法收到來自 zabbix 的電子郵件,我檢查了 /var/log/maillog 發現很多這樣的錯誤:

Apr 30 00:53:44 localhost postfix/master[1283]: warning: process /usr/libexec/postfix/pickup pid 55061 exit status 127
Apr 30 00:53:44 localhost postfix/master[1283]: warning: /usr/libexec/postfix/pickup: bad command startup -- throttling
Apr 30 00:54:44 localhost postfix/master[1283]: warning: process /usr/libexec/postfix/pickup pid 55069 exit status 127
Apr 30 00:54:44 localhost postfix/master[1283]: warning: /usr/libexec/postfix/pickup: bad command startup -- throttling
Apr 30 00:55:44 localhost postfix/master[1283]: warning: process /usr/libexec/postfix/pickup pid 55158 exit status 127
Apr 30 00:55:44 localhost postfix/master[1283]: warning: /usr/libexec/postfix/pickup: bad command startup -- throttling
Apr 29 17:30:26 localhost postfix/postfix-script[55619]: fatal: cannot execute /usr/sbin/postconf!
Apr 29 17:41:40 localhost postfix/postfix-script[55662]: fatal: cannot execute /usr/sbin/postconf!
Apr 29 17:41:49 localhost postfix/postfix-script[55666]: fatal: cannot execute /usr/sbin/postconf!
Apr 29 18:17:01 localhost postfix[55724]: fatal: usage: postfix [-c config_dir] [-Dv] command
Apr 29 18:17:08 localhost postfix/postfix-script[55727]: fatal: cannot execute /usr/sbin/postconf!
Apr 29 18:17:20 localhost postfix/postfix-script[55730]: fatal: cannot execute /usr/sbin/postconf!
Apr 29 18:34:54 localhost postfix/postfix-script[55751]: fatal: cannot execute /usr/sbin/postconf!

然後我檢查了postfix狀態,postfix無法啟動。

[root@localhost ~]# postfix status
postfix: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory
[root@localhost ~]# postfix start
postfix: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory

MySQL lib 目錄列表

[root@localhost ~]# ls -la /usr/local/mysql/lib/
total 216100
drwxr-xr-x.  3 mysql mysql      4096 Apr 29 18:16 .
drwxr-xr-x. 13 mysql mysql      4096 Mar 29 18:09 ..
-rw-r--r--.  1 mysql mysql  11524834 Mar 29 01:35 libmysqlclient.a
lrwxrwxrwx.  1 mysql mysql        16 Mar 29 01:39 libmysqlclient_r.a -> libmysqlclient.a
lrwxrwxrwx.  1 mysql mysql        17 Mar 29 01:39 libmysqlclient_r.so -> libmysqlclient.so
lrwxrwxrwx.  1 mysql mysql        20 Mar 29 01:39 libmysqlclient_r.so.18 -> libmysqlclient.so.18
lrwxrwxrwx.  1 mysql mysql        24 Mar 29 01:39 libmysqlclient_r.so.18.1.0 -> libmysqlclient.so.18.1.0
lrwxrwxrwx.  1 mysql mysql        20 Mar 29 01:39 libmysqlclient.so -> libmysqlclient.so.18
lrwxrwxrwx.  1 mysql mysql        24 Mar 29 01:39 libmysqlclient.so.18 -> libmysqlclient.so.18.1.0
-rwxr-xr-x.  1 mysql mysql   5865820 Mar 29 01:35 libmysqlclient.so.18.1.0
-rw-r--r--.  1 mysql mysql 203859198 Mar 29 01:38 libmysqld.a
-rw-r--r--.  1 mysql mysql     14270 Mar 29 01:35 libmysqlservices.a
drwxr-xr-x.  3 mysql mysql      4096 Mar 29 01:39 plugin

我還嘗試將 libmysqlclient.so.18 連結到 libmysqlclient.so.16,問題沒有解決。

[root@localhost ~]# ln -s  /usr/local/mysql/lib/libmysqlclient.so /usr/lib64/libmysqlclient.so.16
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# postfix start
/usr/sbin/postconf: /usr/lib64/libmysqlclient.so.16: version `libmysqlclient_16' not found (required by /usr/sbin/postconf)
postfix/postfix-script: fatal: cannot execute /usr/sbin/postconf!
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# less /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib/
/usr/local/mysql/lib

包含舊 mysql-libs 的軟體包可在 remi 儲存庫中找到。

您首先安裝儲存庫:

wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6.rpm

然後你可以安裝包:

yum install compat-mysql51.x86_64

引用自:https://unix.stackexchange.com/questions/280712