2012-10-10 64 views
0

我從官方網站安裝了mysql 5.1.61。它已被編譯和安裝,但現在當我嘗試運行簡單rake db:migrate它表現出這樣的錯誤Rails與Mac OS X和mysql2 - LoadError:找不到dlsym符號

Connecting to {:password=>nil, :encoding=>"utf8", :database=>"mnemosyne_spec", :host=>"localhost", :username=>"root", :adapter=>"mysql2"} 
rake aborted! 
LoadError: dlsym(0x7faaf9048bf0, Init_mysql2): symbol not found - /Users/serg/.rvm/gems/[email protected]/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle 

Tasks: TOP => db:migrate 

完全跟蹤:

** Invoke db:migrate (first_time) 
** Execute db:migrate 
Connecting to {:password=>nil, :encoding=>"utf8", :database=>"mnemosyne_spec", :host=>"localhost", :username=>"root", :adapter=>"mysql2"} 
rake aborted! 
LoadError: dlsym(0x7fafa1d30510, Init_mysql2): symbol not found - /Users/serg/.rvm/gems/[email protected]/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle 
/Users/serg/.rvm/gems/[email protected]/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle 
/Users/serg/.rvm/gems/[email protected]/gems/mysql2-0.3.11/lib/mysql2.rb:9 
/Users/serg/.rvm/gems/[email protected]/gems/sequel-3.39.0/lib/sequel/adapters/mysql2.rb:1:in `require' 
/Users/serg/.rvm/gems/[email protected]/gems/sequel-3.39.0/lib/sequel/adapters/mysql2.rb:1 
/Users/serg/.rvm/gems/[email protected]/gems/sequel-3.39.0/lib/sequel/core.rb:379:in `k_require' 
/Users/serg/.rvm/gems/[email protected]/gems/sequel-3.39.0/lib/sequel/core.rb:379:in `tsk_require' 
/Users/serg/.rvm/gems/[email protected]/gems/sequel-3.39.0/lib/sequel/core.rb:100:in `check_requiring_thread' 
/Users/serg/.rvm/gems/[email protected]/gems/sequel-3.39.0/lib/sequel/core.rb:97:in `synchronize' 
/Users/serg/.rvm/gems/[email protected]/gems/sequel-3.39.0/lib/sequel/core.rb:97:in `check_requiring_thread' 
/Users/serg/.rvm/gems/[email protected]/gems/sequel-3.39.0/lib/sequel/core.rb:379:in `tsk_require' 
/Users/serg/.rvm/gems/[email protected]/gems/sequel-3.39.0/lib/sequel/database/connecting.rb:25:in `adapter_class' 
/Users/serg/.rvm/gems/[email protected]/gems/sequel-3.39.0/lib/sequel/database/connecting.rb:67:in `connect' 
/Users/serg/.rvm/gems/[email protected]/gems/sequel-3.39.0/lib/sequel/core.rb:147:in `connect' 
/Users/serg/rails_projects_terminal/brandspotter/mnemosyne/lib/mnemosyne.rb:52:in `db_connect!' 
/Users/serg/rails_projects_terminal/brandspotter/mnemosyne/lib/mnemosyne.rb:32:in `configure' 
/Users/serg/rails_projects_terminal/brandspotter/mnemosyne/lib/mnemosyne.rb:25:in `initialize!' 
/Users/serg/rails_projects_terminal/brandspotter/mnemosyne/lib/mnemosyne/database_tasks.rb:21:in `initialize' 
/Users/serg/rails_projects_terminal/brandspotter/mnemosyne/lib/mnemosyne/database_tasks.rb:83:in `initialize' 
/Users/serg/rails_projects_terminal/brandspotter/mnemosyne/Rakefile:63:in `new' 
/Users/serg/rails_projects_terminal/brandspotter/mnemosyne/Rakefile:63 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain' 
/Users/serg/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/monitor.rb:242:in `synchronize' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run' 
/Users/serg/.rvm/gems/[email protected]/gems/rake-0.9.2.2/bin/rake:33 
/Users/serg/.rvm/gems/[email protected]/bin/rake:19:in `load' 
/Users/serg/.rvm/gems/[email protected]/bin/rake:19 
/Users/serg/.rvm/gems/[email protected]/bin/ruby_noexec_wrapper:14 
Tasks: TOP => db:migrate 

我試圖重新安裝紅寶石和寶石,它什麼也沒有改變。我能做些什麼來解決這個問題?

我的信息:

Mac OS X 10.8.2 Mountain Lion 
Xcode 4.5.1 
osx-gcc-installer 
Mysql Ver 14.14 Distrib 5.1.61, for apple-darwin10.3.0 (i386) using readline 5.1 
RVM 1.16.10 

附:我沒有從自制軟件安裝mysql的問題。

回答

0

我成立了解決方案!

問題出在MySQL安裝。它是x86,它對Mac OS X 10.7 +來說是不正確的。

1)所以,首先我們應該刪除舊版本的MySQL:

$ sudo rm /usr/local/mysql 
$ sudo rm -rf /usr/local/mysql* 
$ sudo rm -rf /Library/StartupItems/MySQLCOM 
$ sudo rm -rf /Library/PreferencePanes/My* 
$ sudo rm -rf /Library/Receipts/mysql* 
$ sudo rm -rf /Library/Receipts/MySQL* 
$ sudo rm -rf /var/db/receipts/com.mysql.* 

1.1),其運行

$ nano /etc/hostconfig 

後刪除符合

MYSQLCOM=-YES- 

2 )只是爲了確保一切都會好起來的,你可以刪除至少mysql的寶石:

$ gem uninstall mysql2 

或者你也可以通過RVM刪除你的寶石所有寶石:

$ rvm gemset empty your-gemset-name 

3)然後安裝64 MySQL版本

4),並安裝所有缺少通過捆綁寶石:

$ bundle 
相關問題