gpt4 book ai didi

mysql - Mavericks 上的 Rails + MySQL - 库未加载 : libmysqlclient. 18.dylib

转载 作者:可可西里 更新时间:2023-11-01 07:16:24 25 4
gpt4 key购买 nike

当我在本地主机 (OSX Mavericks) 上运行 Rails (rails s) 应用程序时,出现此错误

message:/Users/adam/.rvm/gems/ruby-2.0.0-p481/gems/mysql2-0.3.16/lib/mysql2.rb:8:in `require': dlopen(/Users/adam/.rvm/gems/ruby-2.0.0-p481/extensions/x86_64-darwin-13/2.0.0-static/mysql2-0.3.16/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
Referenced from: /Users/adam/.rvm/gems/ruby-2.0.0-p481/extensions/x86_64-darwin-13/2.0.0-static/mysql2-0.3.16/mysql2/mysql2.bundle
Reason: image not found - /Users/adam/.rvm/gems/ruby-2.0.0-p481/extensions/x86_64-darwin-13/2.0.0-static/mysql2-0.3.16/mysql2/mysql2.bundle
from /Users/adam/.rvm/gems/ruby-2.0.0-p481/gems/mysql2-0.3.16/lib/mysql2.rb:8:in `<top (required)>'
from /Users/adam/.rvm/gems/ruby-2.0.0-p481@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
from /Users/adam/.rvm/gems/ruby-2.0.0-p481@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/adam/.rvm/gems/ruby-2.0.0-p481@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
from /Users/adam/.rvm/gems/ruby-2.0.0-p481@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
from /Users/adam/.rvm/gems/ruby-2.0.0-p481@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
from /Users/adam/.rvm/gems/ruby-2.0.0-p481@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
from /Users/adam/.rvm/gems/ruby-2.0.0-p481@global/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
from /Users/adam/rubydev/logistadvise/config/application.rb:7:in `<top (required)>'
from /Users/adam/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /Users/adam/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /Users/adam/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /Users/adam/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

我不确定我是如何安装 MySQL 的,但我猜它位于名为 Cellar 的子文件夹中。

这是我的 bash_profile 的样子:

MYSQL=/usr/local/mysql/bin
export PATH=$PATH:$MYSQL
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
export PG_DUMP="/Applications/Postgres.app/Contents/MacOS/bin/"
#PATH=$PG_DUMP:$PATH
...

如何解决这个问题?

最佳答案

我遇到了同样的问题。因为我是用 brew 安装的,DYLD 的位置变了。试试这个:

export DYLD_LIBRARY_PATH=/usr/local/mysql-5.1.67-osx10.6-x86_64/lib:$DYLD_LIBRARY_PATH

首先检查上面的路径是否存在,并相应地调整导出路径:

ls -1/usr/local/mysql-5.1.67-osx10.6-x86_64

您可能会制作一个符号链接(symbolic link)或其他东西。这对我来说有点烦人,但使用正确的路径为我修复了它。

还可以尝试 which mysql 来检查您的路径中是否有 mysql。如果你没有得到任何输出,显然路径是乱七八糟的。

关于mysql - Mavericks 上的 Rails + MySQL - 库未加载 : libmysqlclient. 18.dylib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24328935/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com