我无法使用rails连接mysql

时间:2012-01-20 20:39:09

标签: mysql ruby-on-rails

我无法将mysql连接到rails,我试图修改database.yml和gemfile,但没有任何效果。请帮忙。

Rails环境配置

git:
  version:    git version 1.7.6.msysgit.0

ruby:
  bin:        C:/RailsInstaller/Ruby1.9.2/bin/ruby.exe
  version:    ruby 1.9.2p290 (2011-07-09) [i386-mingw32]

rails:
  bin:        C:/RailsInstaller/Ruby1.9.2/bin/rails.bat
  version:    Rails 3.1.1

过程

C:\Sites>cd demo

C:\Sites\demo>rake db:migration
rake aborted!
Incorrect MySQL client library version! This gem was compiled for 6.0.0 but the
client library is 5.0.27.

(See full trace by running task with --tracing)

我已经安装了mysql 5.5

2 个答案:

答案 0 :(得分:0)

问题在于客户端库是libmysql.dll。

尝试从此处下载第6版:

http://dev.mysql.com/downloads/connector/c/

使用新文件更改当前文件。

答案 1 :(得分:0)

database yml

development:
  adapter: mysql2
  database: railsapp
  encoding: utf8
  username: root
  password: 1234
  pool: 5
  timeout: 5000

test:
  adapter: mysql2
   database: railsapp
   encoding: utf8
   username: root
  password: 1234
  pool: 5
  timeout: 5000

production:
   adapter: mysql2
    database: railsapp
    encoding: utf8
    username: root
  password: 1234
  pool: 5
  timeout: 5000