开发者

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.

开发者_如何学Go
  1. I downloaded mysql-5.1.50-osx10.6-x86.dmg
  2. Installed all three file.(mysql-{version}-osx10.5-x86.pkg, MySQL.prefPane, MySQLStartupItem.pkg)
  3. execute this to install gem.
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 mysql
Proceed 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 switched to mysql2, see wycat's blog.


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.


Try to install http://rubygems.org/gems/ruby-mysql


We struggled with this for about two hours, reinstalled mysql a couple times, and eventually solved our problem with an "rvm implode" and subsequent reinstall of rvm. This deletes everything under .rvm, so be careful, but if you're using rvm, it's worth a shot.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜