rails无法连接mysql数据库,搞不定,求救

C:\Users\Administrator\rails4>railsserverC:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0... C:\Users\Administrator\rails4>rails server
C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.
rb:2:in `require': Incorrect MySQL client library version! This gem was compiled
for 6.0.0 but the client library is 5.5.28. (RuntimeError)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/m
ysql2/mysql2.rb:2:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/m
ysql2.rb:9:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/m
ysql2.rb:9:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runti
me.rb:72:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runti
me.rb:72:in `block (2 levels) in require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runti
me.rb:70:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runti
me.rb:70:in `block in require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runti
me.rb:59:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runti
me.rb:59:in `require'

from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:13
2:in `require'
from C:/Users/Administrator/rails4/config/application.rb:7:in `<top (req
uired)>'
展开
 我来答
a8515965
2013-06-08 · TA获得超过116个赞
知道答主
回答量:46
采纳率:0%
帮助的人:8.7万
展开全部
你需要需要安装mysql2, 在命令行中输入gem install mysql2,等待安装完成后,进入你创建的项目路径,修改config/database.yml:

adapter: mysql2
encoding: utf8
database: 数据库名
username: 账号(root)
password: 密码
pool: 5
timeout: 5000
修改Gemfile:
将gem 'sqlite3' 改为 gem 'mysql2'
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式