Rails 4 - Gem::LoadError: Specified 'mysql2' for database adapter, but the gem is not loaded

Rails 4 - Gem::LoadError: Specified 'mysql2' for database adapter, but the gem is not loaded


Gemfile :

   # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
   gem 'rails', '4.2.3'
   # Use mysql as the database for Active Record
   gem 'mysql2'

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的版本

gem 'mysql2', ' 0.3.20'
可以参考github上面的解决方案

issue

http://github.com/rails/rails/issues/21544https://github.com/rails/rails/commit/5da5e3772c32593ecf2f27b8865e81dcbe3af692


在解决好问题的后,要重启服务的,这样才能生效


你可能感兴趣的:(Rails,mysql2)