后缀:加载共享库时出错:libmysqlclient.so.16

后缀:加载共享库时出错:libmysqlclient.so.16

postfix:加载共享库时出错: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

答案1

包含旧版 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

相关内容