我正在尝试让 DBD::MySQL 在 Snow Leopard (v10.6.6) 上运行。操作系统附带的默认 Perl 版本是 v5.10.0。因为我已经读到它是 64 位的,所以我继续下载并安装了 64 位版本的 MySQL (mysql-5.5.8-osx10.6-x86_64)。
安装和设置 MySQL 很顺利,here's my config and version number for reference .
我使用 CPAN 下载 DBI 和 DBD::MySQL 驱动程序。然后我:
- 已安装 DBI
- 设置一个 Makefile.PL
- 从命令行运行 make 命令
Makefile.PL 表示将使用以下设置进行编译和测试:
<pre>I will use the following settings for compiling and testing:
cflags (mysql_config ) = -I/usr/local/mysql/include -Os -g -fno-common -fno-strict-aliasing -arch x86_64
embedded (mysql_config ) =
libs (mysql_config ) = -L/usr/local/mysql/lib -lmysqlclient -lpthread
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (User's choice) = r00t!
testsocket (default ) =
testuser (User's choice) = root
To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.
Multiple copies of Driver.xst found in: /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/ /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level/auto/DBI/ at Makefile.PL line 907
Using DBI 1.616 (for perl 5.010000 on darwin-thread-multi-2level) installed in /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/
Writing Makefile for DBD::mysql
</pre>
一切似乎都很顺利,直到我尝试运行 make test :
<pre>t/00base....................NOK 2/6# Tried to use 'DBD::mysql'.
# Error: Can't load '/Users/swm/.cpan/build/DBD-mysql-4.018-Pnd2qz/blib/arch/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Users/swm/.cpan/build/DBD-mysql-4.018-Pnd2qz/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Library not loaded: libmysqlclient.16.dylib
# Referenced from: /Users/swm/.cpan/build/DBD-mysql-4.018-Pnd2qz/blib/arch/auto/DBD/mysql/mysql.bundle
# Reason: image not found at /System/Library/Perl/5.10.0/darwin-thread-multi-2level/DynaLoader.pm line 207.
# at (eval 7) line 2
# Compilation failed in require at (eval 7) line 2.
# BEGIN failed--compilation aborted at (eval 7) line 2.
FAILED--Further testing stopped: Unable to load DBD::mysql
make: *** [test_dynamic] Error 9
</pre>
它失败了,因为它似乎无法找到 DBD 的 mysql.bundle。有没有人遇到过这个问题?或者可以为我指明下一步要尝试的正确方向吗?我的新工作需要 DBI/DBD::MySQL,我正在努力寻找解决方案。
非常感谢。
最佳答案
我通过在/usr/lib/中放置一个指向/usr/local/mysql-5.5.8-osx10.6-x86_64/lib 的符号链接(symbolic link)来解决“库未加载:libmysqlclient.16.dylib”问题/libmysqlclient.16.dylib
关于mysql - DBD::MySQL 在 OSX v10.6.6 上的安装错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4821804/