[root@host_41 mysql]# mysql
mysql: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory

被同事错删除了mysql,搞了一晚上,凡是中文博客的解决方案全部都是shit!!!凡是中文问答网站的解决方案,全部都是装逼。

 

最后:

http://ntcn.net/blog/?p=6575

找到方法:

1. checking for libmysqlclient installed.

[root@node01 mysqli]# ldconfig -v | grep mysql
/usr/lib64/mysql:
libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0
libmysqlclient.so.16 -> libmysqlclient.so.16.0.0
[root@node01 mysqli]#
[root@node01 mysqli]# locate libmysqlclient.so
/usr/lib64/mysql/libmysqlclient.so
/usr/lib64/mysql/libmysqlclient.so.16
/usr/lib64/mysql/libmysqlclient.so.16.0.0
[root@node01 mysqli]#

if output empty then simply run these commands on rpm\yum based linux:

yum install mysql-devel mysql-libs

2. re-compile php-mysql module with path to lib64 folder.

./configure –with-php-config=/usr/local/php/bin/php-config –with-mysql=/usr/bin/ –with-libdir=lib64

3. alternative solution is:

[root@node01 mysql]# ln -s /usr/lib64/mysql/libmysqlclient.so /usr/lib/mysql/libmysqlclient.so

我只想说,傻逼们。。看看牛逼是怎么解决问题的。就2个命令。