在Rails3上安装mysql2

平台:Ruby1.9.2+Rails3.1+MySQL5.1.59

 

最好不要用最新的5.5的MySQL.

 

http://rorguide.blogspot.com/2011/03/installing-mysql2-gem-on-ruby-192-and.html (需要翻*墙)

 

参照这个文章终于解决了.

 

database.yml

 

development:
adapter: mysql2
database: rails
pool: 5
timeout: 5000
username: root
password: root
encoding: utf8
host: localhost

  如果加上port项 ,port : 3306,反倒不好用了.

 

  Rails3.0.9无法和mysql2兼容,好像是rake db:migrate的时候,就会告诉你这个.

 

  感想:ror资料少而散,环境搭配是个难题,真的不适合学习. 祝所有学习ruby,rails的人好运吧.

你可能感兴趣的:(rails3)