当运行程序时会出现如下类似错误时:
error while loading shared libraries: libXXXXXXX.so.1: cannot open shared object file: No such file or directory
在明确已经安装该库的情况下出现上述错误,可能是这个库目录并没有加入到该环境变量中,解决办法如下:
1、更改配置文件
一般安装目录在
/usr/local/lib
将该目录加入到共享库的配置文件中
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig
2、临时解决方案
export LD_LIBRARY_PATH=/usr/local/mysql/lib:$LD_LIBRARY_PATH