【问题标题】:MySQL UDF Lib InstallMySQL UDF 库安装
【发布时间】:2016-07-27 14:54:37
【问题描述】:

我正在尝试安装和使用 MySql UDF Lib,但在其安装过程中遇到 ELF 错误。

我在 Ubuntu 14.04LTS 64 下。

尝试遵循其他一些答案并为编译器添加了-m64 标志,但仍然出现错误。

免责声明:我不是 linux 专家,只是尝试解决程序问题

root@server:/usr/lib/mysql/plugin# sh install.sh
Compiling the MySQL UDF
gcc -fPIC -Wall -m64 -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o /usr/lib/lib_mysqludf_sys.so
MySQL UDF compiled successfully
-e
Please provide your MySQL root password
Enter password:
ERROR 1126 (HY000) at line 29: Can't open shared library 'lib_mysqludf_sys.so' (errno: 11 /usr/lib/mysql/plugin/lib_mysqludf_sys.so: wrong ELF class: ELFCLASS32)
ERROR: unable to install the UDF
root@server:/usr/lib/mysql/plugin#

我的mysqlfile命令:

root@server:/usr/bin# file mysql
mysql: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=23996cc38af44cd87dbcde82f46c47f9047769b0, stripped

还有我的库file 命令:

root@server:/usr/lib# file lib_mysqludf_sys.so
lib_mysqludf_sys.so: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=8bcbe183af9bd452325f14c89810a34c5bfbbedd, not stripped

还有我的 mysqld file 命令:

root@server:/run/mysqld# file /usr/sbin/mysqld
/usr/sbin/mysqld: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=eaac3628f59f9bfefceacef50d86d8cb834c0a7a, stripped

【问题讨论】:

    标签: mysql linux ubuntu-14.04 mysql-udf


    【解决方案1】:

    回复有点晚,但我希望总比没有好:)

    您正在将插件安装到/usr/lib

    gcc -fPIC -Wall -m64 -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o /usr/lib/lib_mysqludf_sys.so
    

    但是您的 MySQL 服务器只寻找安装在 /usr/lib/mysql/plugin 上的插件。

    所以,把上面的 gcc 命令改成

    gcc -fPIC -Wall -m64 -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o /usr/lib/mysql/plugin/lib_mysqludf_sys.so
    

    应该修复 Can't open shared library 'lib_mysqludf_sys.so' 错误。

    希望这会有所帮助。

    【讨论】:

    • 知识永远不会太晚。即使我必须找到另一种解决方案才能继续前进,我也尝试了您的解决方案,并且效果很好。下次我肯定不会再挣扎了。谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-03
    • 2016-09-26
    • 1970-01-01
    • 1970-01-01
    • 2014-07-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多