libmysqlclient.so.16未找到方法

用mysql命令登录的时候报错:

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

搜索 libmysqlclient.so.16 但是没有找到这个文件

[root@iZ www]# locate libmysqlclient.so
/data/db_include/mysql5.7/lib/libmysqlclient.so
/data/db_include/mysql5.7/lib/libmysqlclient.so.20
/data/db_include/mysql5.7/lib/libmysqlclient.so.20.3.4
[root@iZ www]# locate libmysqlclient.so.16
[root@iZ www]# locate libmysqlclient.so.16

网上下载了一个 libmysqlclient.so.16  64位的放在了/usr/lib64目录下 下载地址  

[root@iZ www]# rpm -qa | grep Percona
[root@iZ www]# ldd /usr/bin/mysql
/usr/bin/mysql: /usr/lib64/libmysqlclient.so.16: no version information available (required by /usr/bin/mysql)
        linux-vdso.so.1 =>  (0x00007ffd753d8000)
        libncursesw.so.5 => /lib64/libncursesw.so.5 (0x00007f4d9a17e000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4d99f60000)
        libmysqlclient.so.16 => /usr/lib64/libmysqlclient.so.16 (0x00007f4d99b03000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f4d998cc000)
        libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f4d996b2000)
        libssl.so.10 => /usr/lib64/libssl.so.10 (0x00007f4d99446000)
        libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007f4d99061000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f4d98e4a000)
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f4d98b44000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f4d988c0000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f4d986a9000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f4d98315000)
        libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f4d980f4000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f4d97eef000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f4d9a3b2000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f4d97ce7000)
        libfreebl3.so => /lib64/libfreebl3.so (0x00007f4d97ae4000)
        libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f4d9789f000)
        libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f4d975b8000)
        libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f4d973b4000)
        libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f4d97187000)
        libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f4d96f7c000)
        libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f4d96d78000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f4d96b5e000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f4d9693f000)

继续登录发现还是报错

[root@iZ www]# mysql
mysql: /usr/lib64/libmysqlclient.so.16: no version information available (required by mysql)
mysql: relocation error: mysql: symbol disabled_my_option, version libmysqlclient_16 not defined in file libmysqlclient.so.16 with link time reference

最后解决方法:
原来是以前的文件/usr/bin/mysql没替换的原因
用以下二条命令搞定了。

cd /usr/bin
mv mysql mysql.rpmbak
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql

再次登录:

[root@iZ bin]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

参考文档: libmysqlclient问题  

  

  

posted on 2017-08-11 20:41  老榕树下的咖啡屋  阅读(6463)  评论(0编辑  收藏  举报