耙数据库:迁移(mysql) [英] rake db:migrate (mysql)
问题描述
可能的重复:
库未加载:libmysqlclient.16.dylib 在使用 mysql2 gem 的 OS X 10.6 上运行rails server"时出错
为什么我会收到这个错误??什么意思?
Why i get this error?? What's means?
我已经安装了 mysql2 gem,sudo gem install mysql2"
i have installed mysql2 gem, "sudo gem install mysql2"
宝石文件:
gem 'mysql2'
~: rake db:migrate --trace
~: rake db:migrate --trace
rake aborted!
dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
/Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
/Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2.rb:9
/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `require'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
/Users/leonardo/dev/myproject/config/application.rb:7
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
/Users/leonardo/dev/myproject/Rakefile:5
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `load_rakefile'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
推荐答案
把这段代码放在你的 .profile 和 .bash_profile 文件中.如果您不知道该怎么做,请在每次打开终端时在终端中输入...
Put this bit of code in your .profile and .bash_profile files. If you don't know how to do that, type this in the terminal every time you open it...
导出 DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"
这是我的 .bash_profile 的样子:
This is what my .bash_profile looks like:
alias ll="ls -lahG"
alias whereami="pwd"
export PATH="/Applications/MAMP/bin:/usr/local/bin:/usr/local/sbin:usr/local/my$
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"
要编辑您的 bash,在根 ($) 终端菜单中,输入 ls -la
,然后输入 nano .bash_profile
和/或 nano.profile
进入 bash 的文本编辑器(我只是让它们保持不变,我不知道这可能是多余的).
To edit your bash, in the root ($) terminal menu, type in ls -la
, then type in nano .bash_profile
and/or nano .profile
to get into the text editor for the bash (I just keep them both the same, it might be redundant I don't know).
完成编辑后,按 ctrl-X,然后按返回"返回主菜单,可以这么说.
Once you're done with editing, hit ctrl-X, then 'return' to get back to the main menu, so to speak.
这篇关于耙数据库:迁移(mysql)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!