Rails 3 with mysql problem
I have updated to rails 3 on my Snow leopard. Previously i use sqlite for development. It's working fine when i rake db:create.
Now I'm trying to install mysql on my mac.
sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include
Everything is good. gem created with no error.
I create new project with
rails new p1 -d mysqlProceed with
rake db:create
it shows
Could not find gem 'mysql2 (>= 0, runtime)' in any of the gem sources. Try running `bundle install`.
Then I install new gem. sudo gem install mysql2.
same problem. i got
dyld: lazy symbol binding failed: Symbol not found: _mysql_init Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.3/lib/mysql2/mysql2.bundle Expected in: flat namespace dyld: Symbol not found: _mysql_init Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.3/lib/mysql2/mysql2.bundle Expected in: flat namespace Trace/BPT trap
I deleted the duplicate mysql2.bundle. The result is same. error.
i have read almost all articles on the net. But could solve this problem.
Is it because i installed 32 bit mysql on snow leopard? or my rubygems problem? Why rails 3 suddenly asking for mysql2 gem since i use '-d mysql'.
Rails 3 + MySql on mac
Thank you. Have a nice day.
Rails切换到mysql2,请参阅wycat的博客。
i did multiple try and error with
mysql-5.1.50-osx10.6-x86 mysql-5.1.50-osx10.6-x86_64
I received mysql.prefpane and dyld: lazy symbol binding failed: Symbol not found: _mysql_init problem.
Then I found a post at http://weblog.rubyonrails.org/. It says i need to install
mysql-5.1.50-osx10.5-x86_64
works better. solved both problem. but still got errno: 2. Which i can't create database.
Solved errno:2 by REBOOT the system.
尝试安装http://rubygems.org/gems/ruby-mysql
链接地址: http://www.djcxy.com/p/33276.html上一篇: 未初始化的常量MysqlCompat :: MysqlRes
下一篇: Rails 3与MySQL问题