在我的gemfile中我有:
gem 'mysql2'
我的database.yml如下:
default: &default
adapter: mysql2
database:
username:
password:
host:
pool: 32
socket:
development:
<<:>
production:
<<:>
我运行了bundle update和bundle clean --force,我的Gemfile.lock显示了mysql2。
但是,当我运行bundle clean --force时,我在我的计算机和登台服务器上都得到了这个:
myproject.com(master)$ rake db:migrate
WARNING: Use strings for Figaro configuration. 10000012508 was converted to "10000012508".
WARNING: Use strings for Figaro configuration. 860526407370038 was converted to "860526407370038".
rake aborted!
Gem::LoadError: Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
.....
只是为了确保没有错误版本的mysql2或其他东西,我做了bundle clean --force并再次运行bundle install和bundle update,当我运行gem list时,我看到mysql2 (0.4.0),没有其他版本。
任何想法将是最受欢迎的。
解
这是目前Rails 4.1.x和4.2.x的问题,根据这个错误报告,它将在下一版本的rails 4.2.x中修复(在链接的评论中归功于dcorr)。
同时您可以通过将此行添加到您的gemfile中来降级到版本0.3.18的mysql2来修复:
gem 'mysql2', '~> 0.3.18'