装了mysql不在服务彪了_[已解决] 服务器无法安装 mysql2+ 无法 db:migrate

3fcbe5095273a47ca88696067f1c32a1.png

sudo yum install libmysqlclient-devel 试下,

可能库名字不对,ubuntu 的我知道,centos 的好像是这个.

yum install *mysql*搜索下.

2fc036848e9ffa4b0671d2c03e7b6d97.png

#1 楼 @flowerwrong 我不敢乱装东西啊,这个服务器还有别人在用着数据库呢。我里面有的 MySQL-devel-5.6.15-1.el6.x86_64 与你这个有什么区别?

2fc036848e9ffa4b0671d2c03e7b6d97.png

#3 楼 @floger

555,我之前就看过了,看不懂,因为无论我用

ldconfig -p|grep mysql

还是

ldconfig -p|grep MySQL

都不显示任何结果

4e135ff512e1c738556f34faa1b9f1d6.png

@ 你可以先使用

‘’‘shell

locate libmysqlclient

’‘’

查看是否有这个 lib 包。

你使用

ldconfig -v 跟新一下 ldconfig 缓存 如果还是什么也么有的话,

安装这个

sudo yum install mysql-devel

不会影响 mysql 使用的

2fc036848e9ffa4b0671d2c03e7b6d97.png

sudoyum installlibmysqlclient-devel

运行结果是:

Loaded plugins: fastestmirror, refresh-packagekit

Repository base is listed more than once inthe configuration

Repository updates is listed more than once inthe configuration

Repository extras is listed more than once inthe configuration

Repository centosplus is listed more than once inthe configuration

Repository contrib is listed more than once inthe configuration

Loading mirror speeds from cached hostfile

* epel: mirrors.ustc.edu.cn

Setting up Install Process

No package libmysqlclient-devel available.

Error: Nothing to do

而第二句

yum install *mysql*

运行结果达好几页,摘取头尾是:

Loaded plugins: fastestmirror, refresh-packagekit

Repository base is listed more than once inthe configuration

Repository updates is listed more than once inthe configuration

Repository extras is listed more than once inthe configuration

Repository centosplus is listed more than once inthe configuration

Repository contrib is listed more than once inthe configuration

Loading mirror speeds from cached hostfile

* epel: mirrors.ustc.edu.cn

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package apr-util-mysql.x86_64 0:1.3.9-3.el6_0.1 will be installed

---> Package asterisk-mysql.x86_64 0:1.8.26.1-1.el6 will be installed

--> Processing Dependency: asterisk = 1.8.26.1-1.el6 forpackage: asterisk-mysql-1.8.26.1-1.el6.x86_64

---> Package bacula-director-mysql.x86_64 0:5.0.0-12.el6 will be installed

# ...中间省略无数

--> Finished Dependency Resolution

Error: zabbix20 conflicts with zabbix22-2.2.1-5.el6.x86_64

Error: zabbix20 conflicts with zabbix-1.8.21-1.el6.x86_64

Error: zabbix22 conflicts with zabbix20-2.0.13-2.el6.x86_64

Error: zabbix22 conflicts with zabbix-1.8.21-1.el6.x86_64

Error: mysql-server conflicts with MySQL-server-5.6.15-1.el6.x86_64

Error: mysql-devel conflicts with MySQL-devel-5.6.15-1.el6.x86_64

You could try using --skip-broken to work around the problem

** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:

2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16()(64bit)

2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16(libmysqlclient_16)(64bit)

2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of mysql-libs

2fc036848e9ffa4b0671d2c03e7b6d97.png

#5 楼 @floger 我确定里面是有 MySQL-devel-5.6.15-1.el6.x86_64 的,所以装

sudoyum installmysql-devel

会显示冲突。

另外,

locate libmysqlclient

-bash: locate: commandnot found

从上一个回复来看,我应该是少了

** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:

2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16()(64bit)

2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16(libmysqlclient_16)(64bit)

2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of mysql-libs

但我还是没有明白,MySQL-devel 和 libmysqlclient-devel 有什么区别?

2fc036848e9ffa4b0671d2c03e7b6d97.png

#8 楼 @floger

那其实我现在服务器有的 MySQL-devel 实际就是 ibmysqlclient-devel ,两者是同一个东西罗!

头疼,我已经没法思考了……

帮我看看我刚才的几个操作的结果……

$yum info MySQL-devel

Loaded plugins: fastestmirror, refresh-packagekit

Repository base is listed more than once inthe configuration

Repository updates is listed more than once inthe configuration

Repository extras is listed more than once inthe configuration

Repository centosplus is listed more than once inthe configuration

Repository contrib is listed more than once inthe configuration

Loading mirror speeds from cached hostfile

* epel: mirrors.ustc.edu.cn

Installed Packages

Name : MySQL-devel

Arch : x86_64

Version : 5.6.15

Release : 1.el6

Size : 19 M

Repo : installed

Summary : MySQL - Development header files and libraries

URL : http://www.mysql.com/

License : Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Under GPL license as shown inthe Description field.

Description : This package contains the development header files and libraries necessary

: to develop MySQL client applications.

:

: For a description of MySQL see the base MySQL RPM or http://www.mysql.com/

Available Packages

Name : mysql-devel

Arch : i686

Version : 5.1.73

Release : 3.el6_5

Size : 129 k

Repo : updates

Summary : Files fordevelopment of MySQL applications

URL : http://www.mysql.com

License : GPLv2 with exceptions

Description : MySQL is a multi-user, multi-threaded SQL database server. This

: package contains the libraries and header files that are needed for

: developing MySQL client applications.

Name : mysql-devel

Arch : x86_64

Version : 5.1.73

Release : 3.el6_5

Size : 129 k

Repo : updates

Summary : Files fordevelopment of MySQL applications

URL : http://www.mysql.com

License : GPLv2 with exceptions

Description : MySQL is a multi-user, multi-threaded SQL database server. This

: package contains the libraries and header files that are needed for

: developing MySQL client applications.$ls /usr/lib64/mysql/libmysqlclient*

/usr/lib64/mysql/libmysqlclient.a /usr/lib64/mysql/libmysqlclient_r.a$sudoyum installmysql-libs

Loaded plugins: fastestmirror, refresh-packagekit

Repository base is listed more than once inthe configuration

Repository updates is listed more than once inthe configuration

Repository extras is listed more than once inthe configuration

Repository centosplus is listed more than once inthe configuration

Repository contrib is listed more than once inthe configuration

Loading mirror speeds from cached hostfile

* epel: mirrors.ustc.edu.cn

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package mysql-libs.x86_64 0:5.1.73-3.el6_5 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================

Package Arch Version Repository Size

==============================================================================================================================================================

Installing:

mysql-libs x86_64 5.1.73-3.el6_5 updates 1.2 M

Transaction Summary

==============================================================================================================================================================

Install 1 Package(s)

Total size: 1.2 M

Installed size: 4.0 M

Is this ok [y/N]: Y

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Transaction Check Error:

file /usr/share/mysql/charsets/Index.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/armscii8.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/ascii.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/cp1250.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/cp1256.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/cp1257.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/cp850.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/cp852.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/cp866.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/dec8.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/geostd8.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/greek.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/hebrew.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/hp8.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/keybcs2.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/koi8r.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/koi8u.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/latin1.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/latin2.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/latin5.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/latin7.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/macce.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/macroman.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/charsets/swe7.xml from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/czech/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/danish/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/dutch/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/english/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/estonian/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/french/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/german/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/greek/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/hungarian/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/italian/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/japanese/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/korean/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/norwegian-ny/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/norwegian/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/polish/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/portuguese/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/romanian/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/russian/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/serbian/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/slovak/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/spanish/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/swedish/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

file /usr/share/mysql/ukrainian/errmsg.sys from installof mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package MySQL-server-5.6.15-1.el6.x86_64

Error Summary

-------------

2fc036848e9ffa4b0671d2c03e7b6d97.png

#8 楼 @floger

我感觉这个输出结果是有用的,但不知道怎么用?

yum whatprovides "*libmysqlclient*"

Loaded plugins: fastestmirror, refresh-packagekit

Repository base is listed more than once inthe configuration

Repository updates is listed more than once inthe configuration

Repository extras is listed more than once inthe configuration

Repository centosplus is listed more than once inthe configuration

Repository contrib is listed more than once inthe configuration

Loading mirror speeds from cached hostfile

* epel: mirrors.ustc.edu.cn

# 省略很多……

MySQL-devel-5.6.15-1.el6.x86_64 : MySQL - Development header files and libraries

Repo : installed

Matched from:

Filename : /usr/lib64/mysql/libmysqlclient_r.a

Filename : /usr/lib64/mysql/libmysqlclient.a

因为我就是 MySQL-devel-5.6.15-1.el6.x86_64 这个……

c9b03d2f1fb68554be880633af858e94.png

sudoyum installmysql-devel

2fc036848e9ffa4b0671d2c03e7b6d97.png

#11 楼 @huacnlee

555,不能啊,因为服务器上已经装了一个 MySQL-devel-5.6.15-1.el6.x86_64,会报错说冲突的啊!

$sudoyum installmysql-devel

Loaded plugins: fastestmirror, refresh-packagekit

Repository base is listed more than once inthe configuration

Repository updates is listed more than once inthe configuration

Repository extras is listed more than once inthe configuration

Repository centosplus is listed more than once inthe configuration

Repository contrib is listed more than once inthe configuration

Loading mirror speeds from cached hostfile

* epel: mirrors.ustc.edu.cn

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package mysql-devel.x86_64 0:5.1.73-3.el6_5 will be installed

--> Processing Dependency: mysql = 5.1.73-3.el6_5 forpackage: mysql-devel-5.1.73-3.el6_5.x86_64

--> Processing Dependency: libmysqlclient_r.so.16()(64bit) forpackage: mysql-devel-5.1.73-3.el6_5.x86_64

--> Processing Dependency: libmysqlclient.so.16()(64bit) forpackage: mysql-devel-5.1.73-3.el6_5.x86_64

--> Running transaction check

---> Package mysql.x86_64 0:5.1.73-3.el6_5 will be installed

---> Package mysql-libs.x86_64 0:5.1.73-3.el6_5 will be installed

--> Processing Conflict: mysql-devel-5.1.73-3.el6_5.x86_64 conflicts MySQL-devel

--> Finished Dependency Resolution

Error: mysql-devel conflicts with MySQL-devel-5.6.15-1.el6.x86_64

You could try using --skip-broken to work around the problem

** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:

2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16()(64bit)

2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16(libmysqlclient_16)(64bit)

2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of mysql-libs

2fc036848e9ffa4b0671d2c03e7b6d97.png

#11 楼 @huacnlee

#8 楼 @floger

我觉得是不是应该找个什么方法,让那个 gem mysql2 知道那个/usr/lib64/mysql/libmysqlclient_r.a 之类的位置……

MySQL-devel-5.6.15-1.el6.x86_64 : MySQL - Development header files and libraries

Repo : installed

Matched from:

Filename : /usr/lib64/mysql/libmysqlclient_r.a

Filename : /usr/lib64/mysql/libmysqlclient.a

因为之前报错好像说

linking shared-object mysql2/mysql2.so

/usr/bin/ld: cannot find -lmysqlclient

3fcbe5095273a47ca88696067f1c32a1.png

一.网上搜索的,看着靠谱,但是得删除数据库服务器重装

The above problem will be occured because the mysql-devel package is not properly installed in your system. I will be explain the same in Centos of how to fix it. When you try to install that package using,

yum install mysql-devel

somtimes there will be some clash occurs with the existing packages that gets installed if you install the MySql-Administrative tool and MySQL query browser.

In that case, you need to uninstall all the existing mysql2 packages and install it again.

rpm -qa -last | grep -i mysql

yum remove MySQL-server-5.5.27-1.rhel5

yum remove MySQL-client-5.5.27-1.rhel5

yum remove mysql-gui-tools-5.0r12-1rhel4

yum remove mysql-query-browser-5.0r12-1rhel4-a

So, you can uninstall whatever mysql things displayed with rpm -qa as like above.

Then you can install the mysql-server and mysql-client.

yum install mysql-server

yum install mysql-client

Now you do the installation of mysql-devel package.

yum install mysql-devel

Now there is no package clashes and you can able to install the mysql2 gem.

gem install mysql2 -v '0.3.11'

Now your mysql2 gem will be successfully installed and you are good to go.

二.不用重装,但不知道能不能行

wget http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-devel-5.5.27-1.el6.x86_64.rpm

rpm -Uvh MySQL-devel-5.5.27-1.el6.x86_64.rpm

gem install mysql

gem install mysql2

1385612934709aa78f873f2266a477d6.png

看来都是一通乱搞呀!

错误不是很明显了吧:/usr/bin/ld: cannot find -lmysqlclient

gem install 时指定 mysqlclient.so.X 的目录

或者试试:

Filename : /usr/lib64/mysql/libmysqlclient_r.a

Filename : /usr/lib64/mysql/libmysqlclient.a

Filename : /usr/lib64/mysql/libmysqlclient.so ... 等等

链接到 /usr/lib64/ 下

8c2eb5641d7010f2b3457d1a5b9199c7.png

ubuntu 下 sudo apt-get install libmysqlclient-dev

c1d3097dd6ea981084cebb0427045b8f.png

ln -s /usr/lib64/mysql/libmysqlclient_r.a /usr/lib/mysql/libmysqlclient_r.a

道理上是说 32 位在默认路径下找不到 64 位的 lib,不过很少碰到了。

9c6d902c3fd50a24157ee6662372feed.png

那么多复杂的东西 ... remove 掉相关 mysql 的东西 直接 mysql-devel

sudoyum installgcc g++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel

sudoyum installruby-rdoc ruby-devel

sudoyum installmysql-devel

4e135ff512e1c738556f34faa1b9f1d6.png

@chairy11 发现你安装的 mysql-libs 是 5.1.17 的版本,这个版本的 mysql-libs 和 Mysql 5.6 有冲突的。如果是 5.6 的需要移除 已安装关于 mysql-libs

sudoyum remove mysql-libs

如果是 5.6 的话应该安装的

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-5.6.15-1.el6.x86_64.rpm/from/http://cdn.mysql.com/

rpm -ih MySQL-shared-5.6.15-1.el6.x86_64.rpm

2fc036848e9ffa4b0671d2c03e7b6d97.png

谢谢各位:)

因为服务器上已经有别的项目在用 MySQL,我不敢像大家建议的那样先删除后安装什么的……

结果我领导比较彪悍,直接暴力删除,然后把 gem mysql2 装上了,再恢复 mysql,发现又不行了。

最后,听说他把 libmysqlclient.a, libmysqlclient_r.a, libmysqlservices.a 放到 /usr/lib64 下,就可以了……

反正,现在是可以了,天都亮了!

再次谢谢各位朋友帮忙!非常感谢!

2fc036848e9ffa4b0671d2c03e7b6d97.png

#15 楼 @gihnius 哎呀呀,又出错啦!说找不到 libmysqlclient_r.so,请问这个东东在哪里啊?或者我怎么才能让 gem 知道地址啊?

$bin/rake db:migrate

rake aborted!

LoadError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory - /usr/local/rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/mysql2-0.3.16/mysql2/mysql2.so

/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'

/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require'

/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'

/usr/local/rvm/gems/ruby-2.1.2/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'

/usr/local/rvm/gems/ruby-2.1.2/gems/mysql2-0.3.16/lib/mysql2.rb:8:in `'

/usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'

/usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) inrequire'

/usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'

/usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block inrequire'

/usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'

/usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'

/usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'

/

2fc036848e9ffa4b0671d2c03e7b6d97.png

$bin/rake db:migrate

rake aborted!

LoadError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory - /usr/local/rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/mysql2-0.3.16/mysql2/mysql2.so

有可能是你说的那个『 mysql-libs 是 5.1.17 的版本,和 Mysql 5.6 有冲突』的问题。

但我看不懂你这两句命令不太敢用啊……

sudoyum remove mysql-libs

会删除我现在的 5.1.17 的 lib?

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-5.6.15-1.el6.x86_64.rpm/from/http://cdn.mysql.com/

rpm -ih MySQL-shared-5.6.15-1.el6.x86_64.rpm

只是安装匹配的 lib?

1385612934709aa78f873f2266a477d6.png

#23 楼 @chairy11 看看这个:

ldd /usr/local/rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/mysql2-0.3.16/mysql2/mysql2.so

链接的 lib 在什么目录.

之前那些文件是链接的还是移动 (mv) 的?

反正文件都在,放到正常的位置应该没问题的。

2fc036848e9ffa4b0671d2c03e7b6d97.png

ldd /usr/local/rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/mysql2-0.3.16/mysql2/mysql2.so

linux-vdso.so.1 => (0x00007fff5bd47000)

libruby.so.2.1 => /usr/local/rvm/rubies/ruby-2.1.2/lib/libruby.so.2.1 (0x00007f0a83f1e000)

libmysqlclient_r.so.16 => not found

libz.so.1 => /lib64/libz.so.1 (0x00007f0a83cfa000)

libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f0a83add000)

libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f0a838a5000)

libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f0a8368c000)

libm.so.6 => /lib64/libm.so.6 (0x00007f0a83408000)

libssl.so.10 => /usr/lib64/libssl.so.10 (0x00007f0a8319b000)

libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007f0a82db8000)

librt.so.1 => /lib64/librt.so.1 (0x00007f0a82bb0000)

libdl.so.2 => /lib64/libdl.so.2 (0x00007f0a829ab000)

libc.so.6 => /lib64/libc.so.6 (0x00007f0a82618000)

/lib64/ld-linux-x86-64.so.2 (0x00007f0a845cb000)

libfreebl3.so => /lib64/libfreebl3.so (0x00007f0a823b6000)

libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f0a82171000)

libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f0a81e8b000)

libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f0a81c87000)

libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f0a81a5a000)

libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f0a8184f000)

libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f0a8164b000)

libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f0a81431000)

libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f0a81212000)

看来我机子上应该是没有这个文件的。

之前的应该是复制过去的吧……

1385612934709aa78f873f2266a477d6.png

#26 楼 @chairy11 这个 libmysqlclient_r.so.16 => not found 在 /usr/lib64/mysql 有没有?没有的话就重新安装 mysql 吧,可能都被搞得一塌糊涂了。

1385612934709aa78f873f2266a477d6.png

#26 楼 @chairy11 这个 libmysqlclient_r.so.16 => not found 在 /usr/lib64/mysql 有没有?没有的话就重新安装 mysql 吧,可能都被搞得一塌糊涂了。

2fc036848e9ffa4b0671d2c03e7b6d97.png

#28 楼 @gihnius

不敢重装了啊……昨天我领导重装了,今天跟我说,再也不帮我弄了……那个 mysql 上有别的项目在跑啊……我不能随便弄啊……

而且昨天他复制那三个文件过去,好像说这样还是不好。能不能像你说的,gem install 时指定这些东西的目录?我不知道怎么指定呀……能帮我写个命令行吗?

4e135ff512e1c738556f34faa1b9f1d6.png

#24 楼 @chairy11

是的那个删除命令,只会删除你当前版本 libs

那个安装命令就是告诉你要安装 对应版本的 libs

好像在 5.6 里移除 libmysqlclient 的 lib,放在 Mysql-share 里面了。

这个在

http://dev.mysql.com/doc/refman/5.6/en/linux-installation-rpm.html

有说明的

If you get a dependency failure when trying to install MySQL packages (for example, error: removing these packages would break dependencies: libmysqlclient.so.10 is needed by ...), you should also install the MySQL-shared-compat package, which includes the shared libraries for older releases for backward compatibility.

As of MySQL 5.6.5, the MySQL-shared-compat RPM package enables users of Red Hat-provided mysql--5.1 RPM packages to migrate to Oracle-provided MySQL--5.5 packages. MySQL-shared-compat replaces the Red Hat mysql-libs package by replacing libmysqlclient.so files of the latter package, thus satisfying dependencies of other packages on mysql-libs. This change affects only users of Red Hat (or Red Hat-compatible) RPM packages. Nothing is different for users of Oracle RPM packages.

3fcbe5095273a47ca88696067f1c32a1.png

我找了下,首先查找 libmysqlclient.so.16 文件,如果有就ldd,没有就安装他,如下:

https://gettechgo.wordpress.com/2012/12/03/failed-dependency-libmysqlcliet-so-16/

原文:

While installing ‘mysql’ module for PHP 5.4 (yum install php54w-mysql*), I encountered the following error:

Missing Dependency: libmysqlclient.so.16(libmysqlclient_16) is needed by package php-mysql-package-version

The issue was due to the “Missing Dependency” and a library called “libmysqlclient.so.16″

was required.

To resolve this, I downloaded a “compat” rpm, and installed all the different versions of

libmysqlclient.so.{12,14,15,16}:

Available at: http://downloads.mysql.com/archives/mysql-5.1/MySQL-shared-compat-5.1.49-1.rhel5.x86_64.rpm

wget "http://downloads.mysql.com/archives/mysql-5.1/MySQL-shared-compat-5.1.49-1.rhel5.x86_64.rpm"

rpm -ivh MySQL-shared-compat-5.1.49-1.rhel5.x86_64.rpm

After that, ‘mysql’ module got installed with PHP 5.4 properly.

2fc036848e9ffa4b0671d2c03e7b6d97.png

#30 楼 @floger

555,好像不行,竟然说我没装 lib

$sudoyum remove mysql-libs

Loaded plugins: fastestmirror, refresh-packagekit

Setting up Remove Process

No Match forargument: mysql-libs

Repository base is listed more than once inthe configuration

Repository updates is listed more than once inthe configuration

Repository extras is listed more than once inthe configuration

Repository centosplus is listed more than once inthe configuration

Repository contrib is listed more than once inthe configuration

Loading mirror speeds from cached hostfile

* epel: mirrors.ustc.edu.cn

Package(s) mysql-libs available, but not installed.

No Packages marked forremoval

好像下面那个能下载成功,可是它为什么带着 redhat-package 的说法的?我用 centos 的哦,有针对性的吗?

$wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-5.6.15-1.el6.x86_64.rpm/from/http://cdn.mysql.com/

--2014-10-31 06:31:36-- http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-5.6.15-1.el6.x86_64.rpm/from/http://cdn.mysql.com/

正在解析主机 dev.mysql.com... 137.254.60.11

正在连接 dev.mysql.com|137.254.60.11|:80... 已连接。

已发出 HTTP 请求,正在等待回应... 302 Found

位置:http://cdn.mysql.com/archives/mysql-5.6/MySQL-shared-5.6.15-1.el6.x86_64.rpm [跟随至新的 URL]

--2014-10-31 06:31:36-- http://cdn.mysql.com/archives/mysql-5.6/MySQL-shared-5.6.15-1.el6.x86_64.rpm

正在解析主机 cdn.mysql.com...

23.41.85.226

正在连接 cdn.mysql.com|23.41.85.226|:80... 已连接。

已发出 HTTP 请求,正在等待回应... 200 OK

长度:1937596 (1.8M) [application/x-redhat-package-manager]

正在保存至: “index.html”

100%[====================================================================================================================>] 1,937,596 1.00M/s in1.8s

2014-10-31 06:31:45 (1.00 MB/s) - 已保存 “index.html” [1937596/1937596])

但又安装不上:

$rpm -ih MySQL-shared-5.6.15-1.el6.x86_64.rpm

error: open of MySQL-shared-5.6.15-1.el6.x86_64.rpm failed: 没有那个文件或目录

2fc036848e9ffa4b0671d2c03e7b6d97.png

#31 楼 @flowerwrong 根据官方手册写的和我的版本 (MySQL-server-5.6.15-1.el6.x86_64, MySQL-client-5.6.15-1.el6.x86_64, MySQL-devel-5.6.15-1.el6.x86_64), 我觉得我需要安装 MySQL-shared-compat .

你给的解决方案我觉得对,但我觉得你给的版本应该改为 MySQL-shared-5.6.15-1.el6.x86_64.rpm,或者 MySQL-shared-compat-5.6.15-1.el6.x86_64.rpm。

我正在找匹配的地址。

2fc036848e9ffa4b0671d2c03e7b6d97.png

#30 楼 @floger

我觉得你找的这个问题根源对了。但那个 wget 的地址好像不对,保存之后是一个网页。我试试找找新的地址哦!

2fc036848e9ffa4b0671d2c03e7b6d97.png

现在情况如下:

$wget http://cdn.mysql.com/archives/mysql-5.6/MySQL-shared-5.6.15-1.el6.x86_64.rpm

rpm -ih MySQL-shared-5.6.15-1.el6.x86_64.rpm$wget http://cdn.mysql.com/archives/mysql-5.6/MySQL-shared-compat-5.6.15-1.el6.x86_64.rpm

rpm -ih MySQL-shared-compat-5.6.15-1.el6.x86_64.rpm$rpm -qa|grep -i MySQL

MySQL-shared-5.6.15-1.el6.x86_64

MySQL-server-5.6.15-1.el6.x86_64

MySQL-client-5.6.15-1.el6.x86_64

MySQL-shared-compat-5.6.15-1.el6.x86_64

MySQL-devel-5.6.15-1.el6.x86_64

问题解决了!谢谢谢谢啊:)真的太好了!折腾了两三天!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值