Gem::LoadError for mysql2 gem, but it's already in Gemfile

后端 未结 14 2642
醉酒成梦
醉酒成梦 2020-12-02 08:35
Gem::LoadError
Specified \'mysql2\' for database adapter, but the gem is not loaded.
Add `gem \'mysql2\'` to your Gemfile

This error occurred while

14条回答
  •  青春惊慌失措
    2020-12-02 08:58

    If you have this error when upgrading to rails 4.2.4 (also with rails 4.1.5) try using this version of mysql2:

    gem 'mysql2', '~> 0.3.18'
    

    Apparently mysql2 isn't still compatible with newer version of rails because rails 4.2.4 is pretty new as the time of answering this question by me 8 September 2015 so use the above line in your Gem file and run:

    bundle install 
    

    You should be good to go

提交回复
热议问题