今天从db01上copy复制一个mysql库到db02上,前面操作已经顺利。数据库也可以正常启动。本以为ok了,结果在执行命令登录mysql库时,报如下错误:

 
点击(此处)折叠或打开
  1. [root@db02 ~]# mysql3306
  2. /data/mysql-3306/bin/mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory


解决方法:
1.从db01好用的一台mysql服务器上,将两个lib包拷贝到db02相应路径:

点击(此处)折叠或打开
  1. [root@fz-db01 ~]# scp -r /lib/libtinfo.so.5.7 192.168.1.2:/lib/
  2. libtinfo.so.5.7 100% 96KB 95.8KB/s 00:00
  3. [root@fz-db01 ~]# scp -r /lib64/libtinfo.so.5.7 192.168.1.2:/lib64/
  4. libtinfo.so.5.7 100% 135KB 135.0KB/s 00:00

 
2.在db02上创建相应的软链接:

点击(此处)折叠或打开
  1. [root@db02 ~]# ln -sn /lib/libtinfo.so.5.7 /lib/libtinfo.so.5
  2. [root@db02 ~]# ln -sn /lib64/libtinfo.so.5.7 /lib64/libtinfo.so.5

3.再次执行连接命令进行测试如下:

 
点击(此处)折叠或打开
  1. [root@db02 ~]# mysql3306
  2. Welcome to the MySQL monitor. Commands end with ; or \g.
  3. Your MySQL connection id is 7
  4. Server version: 5.5.21-log Source distribution
  5. Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  6. Oracle is a registered trademark of Oracle Corporation and/or its
  7. affiliates. Other names may be trademarks of their respective
  8. owners.
  9. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  10. mysql> quit
  11. Bye

本来是一个很简单的问题,从网上下载lib包啥的,查资料愣是折腾了好半天;其实,回头认真思考一下,就很容易想到可以从好用的那台mysql库入手,将问题解决掉的。简单记录下来,留做备忘吧!