在rails中加载或迁移数据库时出错

时间:2011-03-23 03:06:11

标签: ruby-on-rails ruby

每当我尝试使用rake db:schema:load或rake db:migrate时,我都会遇到以下错误:

The bundled mysql.rb driver has been removed from Rails 2.2.
Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load — mysql

我已安装了mysql gem,版本为2.8.1。我错过了什么吗?

的database.yml

development:
  adapter: mysql
  database: db_development
  host: localhost
  username: root
  password: password
  encoding: utf8
  socket: /Applications/rubystack/mysql/tmp/mysql.sock

1 个答案:

答案 0 :(得分:2)

尝试安装mysql2 gem

sudo gem install mysql2

如果您使用的是Rails 3,请添加

gem 'mysql2'

到您的Gemfile&跑

bundle install

将适配器更改为database.yml中的mysql2。我用这个解决了很多问题,也可以解决你的问题。