MYSQL缺少libmysqlclient.so.16文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MYSQL缺少libmysqlclient.so.16文件相关的知识,希望对你有一定的参考价值。

<table cellSpacing=0 cellPadding=0><tbody><tr><td>mysqldump: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory我是fedora8 前一天还好好的 第二天就不能mysqldump了,其他没问题,在远程也可以备份有libmysqlclient.so.15的文件 请高手支招 谢谢!</td></tr></tbody></table>

原因:没有加载成功造成的。

1、首先找到libmysqlclient.so.16文件的位置:

 [root@iZbp11rfoyeescusr9ha9qZ ~]# locate libmysqlclient.so.16

 /usr/lib64/mysql/libmysqlclient.so.16


/usr/lib64/mysql/libmysqlclient.so.16.0.0

2、然后在/etc/ld.so.conf中添加一行“/usr/lib64/mysql/libmysqlclient.so.16”,并重新加载配置:

 [root@iZbp11rfoyeescusr9ha9qZ ~]# echo "/usr/lib64/mysql/libmysqlclient.so.16" >> /etc/ld.so.conf

 [root@iZbp11rfoyeescusr9ha9qZ ~]# ldconfig

3、之后重启zabbix-server服务,即可成功启动服务:

 [root@iZbp11rfoyeescusr9ha9qZ ~]# 

 [root@iZbp11rfoyeescusr9ha9qZ ~]# /etc/init.d/zabbix-server start  Starting Zabbix server:                                    [  OK  ]

参考技术A

原因可能是安装mysql时,直接源码安装的,有些库没有导入。

1、从mysql官网下载包,如下图

2、解压压缩包

MySQL-client-5.6.36-1.linux_glibc2.5.x86_64.rpm         #MySQL客户端程序

MySQL-devel-5.6.36-1.linux_glibc2.5.x86_64.rpm           #MySQL的库和头文件

MySQL-embedded-5.6.36-1.linux_glibc2.5.x86_64.rpm        #MySQL的嵌入式程序

MySQL-server-5.6.36-1.linux_glibc2.5.x86_64.rpm          #MySQL服务端程序

MySQL-shared-5.6.36-1.linux_glibc2.5.x86_64.rpm          #MySQL的共享库

MySQL-shared-compat-5.6.36-1.linux_glibc2.5.x86_64.rpm   #RHEL兼容包

MySQL-test-5.6.36-1.linux_glibc2.5.x86_64.rpm            #MySQL的测试组件

3、取其中的MySQL-shared-compat-5.6.36-1.linux_glibc2.5.x86_64.rpm,执行安装

[root@iZ23tjtbt43Z opt]# rpm -ivh MySQL-shared-compat-5.6.36-1.linux_glibc2.5.x86_64.rpm 

warning: MySQL-shared-compat-5.6.36-1.linux_glibc2.5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                ########################################### [100%]

   1:MySQL-shared-compat    ########################################### [100%]

4.、安装perl-DBD-MySQL,这样就完成了。

参考技术B 1 确保安装了同一版本的mysql-server, mysql-client, mysql-shared;
2 如果还提示找不到libmysqlclient.so.16 ,使用下面定位so位置并建立软链接;
>whereis libmysqlclient.so.16
>ldd /usr/bin/mysqldump --这个会使用那些so及路径,也包括了not found的libmysqlclient.so.16
>LD_DEBUG=libs /usr/bin/mysqldump -v
--根据上边结果建立软链接,前一个为映射的位置,后边为文件实际路径(根据实际情况创建)

>ln -s /usr/lib/mysql/libmysqlclient.so.16 /usr/lib64/mysql/libmysqlclient.so.16

收工。
参考技术C 1 确保安装了同一版本的mysql-server, mysql-client, mysql-shared;
2 如果还提示找不到libmysqlclient.so.16 ,使用下面定位so位置并建立软链接;
>whereis libmysqlclient.so.16
>ldd /usr/bin/mysqldump --这个会使用那些so及路径,也包括了not found的libmysqlclient.so.16
>LD_DEBUG=libs /usr/bin/mysqldump -v
--根据上边结果建立软链接,前一个为映射的位置,后边为文件实际路径(根据实际情况创建)

>ln -s /usr/lib/mysql/libmysqlclient.so.16 /usr/lib64/mysql/libmysqlclient.so.16
参考技术D mysql-shared-compat 找这个对应你mysql版本的rpm包安装。

定位 libmysqlclient_r.so.16 问题

【中文标题】定位 libmysqlclient_r.so.16 问题【英文标题】:locate libmysqlclient_r.so.16 issue 【发布时间】:2012-11-23 20:20:14 【问题描述】:

首先要建议我是新手,而我的网页设计师不在国外。我有以下问题并寻求一些建议。我已经重新安装了 mysqldb 并升级了软件包。我和我的托管公司谈过,他们建议他们升级到 mysql 5.5。

我搜索了 web 和 ***,并尝试了上述许多不同的解决方案。

这是来自服务器错误日志的错误:

    [Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr: Traceback (most recent call last):
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:   File "/home1/elitejdm/python/lib/python2.5/site-packages/flup-1.0.3.dev_20110405-py2.5.egg/flup/server/fcgi_base.py", line 574, in run
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:     protocolStatus, appStatus = self.server.handler(self)
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:   File "/home1/elitejdm/python/lib/python2.5/site-packages/flup-1.0.3.dev_20110405-py2.5.egg/flup/server/fcgi_base.py", line 1159, in handler
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:     result = self.application(environ, start_response)
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:   File "/home/elitejdm/python/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 194, in __call__
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:     self.load_middleware()
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:   File "/home/elitejdm/python/lib/python2.5/site-packages/django/core/handlers/base.py", line 38, in load_middleware
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:     mod = __import__(mw_module, , , [''])
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:   File "/home/elitejdm/python/lib/python2.5/site-packages/django/contrib/flatpages/middleware.py", line 1, in 
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:     from django.contrib.flatpages.views import flatpage
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:   File "/home/elitejdm/python/lib/python2.5/site-packages/django/contrib/flatpages/views.py", line 1, in 
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:     from django.contrib.flatpages.models import FlatPage
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:   File "/home/elitejdm/python/lib/python2.5/site-packages/django/contrib/flatpages/models.py", line 2, in 
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:     from django.db import models
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:   File "/home/elitejdm/python/lib/python2.5/site-packages/django/db/__init__.py", line 17, in 
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:     backend = __import__('%s%s.base' % (_import_path, settings.DATABASE_ENGINE), , , [''])
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:   File "/home/elitejdm/python/lib/python2.5/site-packages/django/db/backends/mysql/base.py", line 12, in 
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr:     raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
[Wed Dec 05 12:12:47 2012] [warn] [client 146.145.36.41] mod_fcgid: stderr: ImproperlyConfigured: Error loading MySQLdb module: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory

这又是同样的错误,但通过 python:

python jdm_cars.fcgi

WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
/home1/elitejdm/python/lib/python2.5/site-packages/MySQL_python_embedded-1.2.3-py2.5-linux-x86_64.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /home1/elitejdm/python/lib/python2.5/site-packages/MySQL_python_embedded-1.2.3-py2.5-linux-x86_64.egg/_mysql.py, but /home1/elitejdm/public_html/new_elitejdm/MySQL-python-1.2.3 is being added to sys.path
  import sys, pkg_resources, imp
Traceback (most recent call last):
  File "/home1/elitejdm/python/lib/python2.5/site-packages/flup-1.0.3.dev_20110405-py2.5.egg/flup/server/fcgi_base.py", line 574, in run
    protocolStatus, appStatus = self.server.handler(self)
  File "/home1/elitejdm/python/lib/python2.5/site-packages/flup-1.0.3.dev_20110405-py2.5.egg/flup/server/fcgi_base.py", line 1159, in handler
    result = self.application(environ, start_response)
  File "/home/elitejdm/python/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 194, in __call__
    self.load_middleware()
  File "/home/elitejdm/python/lib/python2.5/site-packages/django/core/handlers/base.py", line 38, in load_middleware
    mod = __import__(mw_module, , , [''])
  File "/home/elitejdm/python/lib/python2.5/site-packages/django/contrib/flatpages/middleware.py", line 1, in <module>
    from django.contrib.flatpages.views import flatpage
  File "/home/elitejdm/python/lib/python2.5/site-packages/django/contrib/flatpages/views.py", line 1, in <module>
    from django.contrib.flatpages.models import FlatPage
  File "/home/elitejdm/python/lib/python2.5/site-packages/django/contrib/flatpages/models.py", line 2, in <module>
    from django.db import models
  File "/home/elitejdm/python/lib/python2.5/site-packages/django/db/__init__.py", line 17, in <module>
    backend = __import__('%s%s.base' % (_import_path, settings.DATABASE_ENGINE), , , [''])
  File "/home/elitejdm/python/lib/python2.5/site-packages/django/db/backends/mysql/base.py", line 12, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
ImproperlyConfigured: Error loading MySQLdb module: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
Status: 500 Internal Server Error
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>Unhandled Exception</title>
</head><body>
<h1>Unhandled Exception</h1>
<p>An unhandled exception was thrown by the application.</p>
</body></html>

在写这篇文章时,我从我的托管公司那里发现了更多信息,我被告知以下内容

基本上我们将 libmysqlclient 更新为: libmysqlclient_r.so.18

来自: libmysqlclient_r.so.16

由于处于共享托管环境中,我们必须使这些 不时更新。看来这是导致您的原因 悲伤/问题。

您要么需要在本地重新安装 libmysqlclient_r.so.16 您的服务器没有 root 访问权限。 (没有百胜)

OR B 配置您的脚本以处理新的 .18 版本。

如果您采用第一种方式,则以后无需更新。如果 你用第二种方法,我们决定再次更新。它会 要求您再次更新脚本

对此很陌生,所以我不知道该怎么做,但愿意学习...请任何帮助表示赞赏。

【问题讨论】:

您能告诉我们您正在运行什么发行版,以及 django 是如何安装的吗? 我不确定 django 是如何安装的。我不是设计师。他正在休假。至于版本,你去吧! Linux 版本 2.6.32-20120131.55.1.bh6.x86_64 (machbuild@build6.bluehost.com) (gcc 版本 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC)) #1 SMP 1 月 31 日 15 日星期二: 2012 年美国东部标准时间 43:27 至于django你指的是easy_install吗? 【参考方案1】:

Python module issue

请查看此线程的第二个答案。修复了我的问题。

【讨论】:

以上是关于MYSQL缺少libmysqlclient.so.16文件的主要内容,如果未能解决你的问题,请参考以下文章

重启Zabbix服务提示缺少libmysqlclient.so.18解决方法

libmysqlclient.so.16未找到方法

mysql2.so:libmysqlclient_r.so.15:无法打开共享对象文件:没有这样的文件或目录

hue集成mysql找不到 libmysqlclient.so.16问题解决

更新到 Ubuntu 16.04 后 mysql2 gem 无法正常工作 - libmysqlclient.so.18

error while loading shared libraries:libmysqlclient.so.18 错误