解决:error while loading shared libraries: libmysqlclient_r.so.15: wrong ELF class: ELFCLASS64问题

在一次更新数据库操作完成后,出现:
error while loading shared libraries: libmysqlclient_r.so.15: wrong ELF class: ELFCLASS64

./sysInit: error while loading shared libraries: libmysqlclient.so.15:......

无法启动程序,试了许多方法还是不奏效,后来查看得知该服务器是支持64位的,但该程序是32位的,数据库也是32位的;最后解决方法如下:

[psx@loghost bin]$ file sysInit  //确认当前运行的程序是32位还是64位的;得出当前程序是32位的;
sysInit: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically
linked (uses shared libs), for GNU/Linux 2.2.5, stripped


[psx@loghost bin]$ ldd sysInit   //确认当前程序是否正确调用动态链接库;发现 libmysqlclient.so.15 => not found
        linux-gate.so.1 =>  (0xffffe000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x008fc000)
        librt.so.1 => /lib/librt.so.1 (0x0093e000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x00a79000)
        libz.so.1 => /usr/lib/libz.so.1 (0x005a6000)
        libmysqlclient.so.15 => not found
        libm.so.6 => /lib/libm.so.6 (0x00915000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0xf7f2f000)
        libc.so.6 => /lib/libc.so.6 (0x007b0000)
        libnss_files.so.2 => /lib/libnss_files.so.2 (0xf7f24000)
        libnss_dns.so.2 => /lib/libnss_dns.so.2 (0xf7f1e000)
        libresolv.so.2 => /lib/libresolv.so.2 (0xf7f0b000)
        /lib/ld-linux.so.2 (0x00792000)


[root@loghost lib]# ldconfig -p |grep mysql   //查看当前现有可用的动态链接库;发现链接的是64位的,问题知道了就是因为程序是32位的而数据库的动态链接库是64位的;
        libmysqlclient_r.so.15 (libc6,x86-64) => /usr/lib/libmysqlclient_r.so.15
        libmysqlclient.so.15 (libc6,x86-64) => /usr/lib/libmysqlclient.so.15
        libmysqlclient.so (libc6) => /usr/lib/libmysqlclient.so
        libmysqlclient.so (libc6) => /usr/lib64/libmysqlclient.so

于是把/usr/local/mysql/lib目录下的bmysqlclient.so.15做个软连接到这里,然后试着去启动程序,结果是可以了;受到了该网友的启发
http://my.oschina.net/captaintheron/blog/3974?from=rss


你可能感兴趣的:(数据库,mysql,职场,休闲)