在我的gemfile我有:
gem 'mysql2'
我的database.yml如下:
default: &default
adapter: mysql2
database:
username:
password:
host:
pool: 32
socket:
development:
<<:>
production:
<<:>
我已经运行bundle更新和bundle安装和我的Gemfile.lock显示mysql2。
但是当我运行rake db:migrate我在我的电脑和登台服务器上得到这个:
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或东西,我做捆绑清理–force和运行捆绑安装和捆绑更新再次,当我运行gem列表我看到mysql2(0.4.0),没有其他版本。
任何想法将最感谢。
解
它目前是Rails 4.1.x和4.2.x的一个问题,根据这个bug report,它将被固定在rails 4.2.x的下一个版本(贷记到dcorr在链接的评论)。
在同一时间,你可以通过将下面的行降级到版本0.3.18的mysql2通过将此行添加到您的gemfile修复:
gem 'mysql2', '~> 0.3.18'