8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 2 安装 MySQL / 2.10 Perl 安装注意事项 / 2.10.3 使用 Perl DBI/DBD 接口的问题
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

2.10.3 使用 Perl DBI/DBD 接口的问题2.10.3 Problems Using the Perl DBI/DBD Interface

如果 Perl 报告找不到 ../mysql/mysql.so 模块,则问题可能是 Perl 找不到 libmysqlclient.so 共享库。您应该能够通过以下方法之一解决此问题:If Perl reports that it cannot find the ../mysql/mysql.so module, the problem is probably that Perl cannot locate the libmysqlclient.so shared library. You should be able to fix this problem by one of the following methods:

  • 将 libmysqlclient.so 复制到其他共享库所在的目录(可能是 /usr/lib 或 /lib)。Copy libmysqlclient.so to the directory where your other shared libraries are located (probably /usr/lib or /lib).

  • 修改-L编译所用选项DBD::mysql实际位置libmysqlclient.so.Modify the -L options used to compile DBD::mysql to reflect the actual location of libmysqlclient.so.

  • 在 Linux 上,可以将libmysqlclient.so所在目录的路径名添加到/etc/ld.so.conf文件中。On Linux, you can add the path name of the directory where libmysqlclient.so is located to the /etc/ld.so.conf file.

  • 将libmysqlclient.so所在目录的路径名添加到LD_RUN_PATH环境变量中。有些系统使用 LD_LIBRARY_PATH 代替。 Add the path name of the directory where libmysqlclient.so is located to the LD_RUN_PATH environment variable. Some systems use LD_LIBRARY_PATH instead.

请注意,如果链接器无法找到其他库,您可能还需要修改 -L 选项。例如,如果链接器无法找到 libc,因为它位于 /lib 中,并且链接命令指定了 -L/usr/lib,请将 -L 选项更改为 -L/lib 或将 -L/lib 添加到现有链接命令中。Note that you may also need to modify the -L options if there are other libraries that the linker fails to find. For example, if the linker cannot find libc because it is in /lib and the link command specifies -L/usr/lib, change the -L option to -L/lib or add -L/lib to the existing link command.

如果您得到出现 DBD::mysql 错误后,您可能正在使用 gcc (或使用使用 gcc 编译的旧二进制文件):If you get the following errors from DBD::mysql, you are probably using gcc (or using an old binary compiled with gcc):

/usr/bin/perl: can't resolve symbol '__moddi3'
/usr/bin/perl: can't resolve symbol '__divdi3'

添加 -L/usr/lib/gcc-lib/... -lgcc 到链接命令,当 mysql.so 库已构建(编译 Perl 客户端时,请检查 mysql.so 的 make 的输出)。 -L 选项应指定系统上 libgcc.a 所在目录的路径名。Add -L/usr/lib/gcc-lib/... -lgcc to the link command when the mysql.so library gets built (check the output from make for mysql.so when you compile the Perl client). The -L option should specify the path name of the directory where libgcc.a is located on your system.

导致此问题的另一个原因可能是 Perl 和 MySQL 不是都使用 gcc 编译的。在这种情况下,您可以通过使用 gcc 进行编译来解决不匹配问题。Another cause of this problem may be that Perl and MySQL are not both compiled with gcc. In this case, you can solve the mismatch by compiling both with gcc.