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

前端 未结 9 938
一整个雨季
一整个雨季 2020-12-02 06:13

In my gemfile I have:

gem \'mysql2\'

My database.yml is as follows:

default: &default
  adapter: mysql2
  database: <         


        
9条回答
  •  孤街浪徒
    2020-12-02 06:46

    This issue was addressed here: https://github.com/brianmario/mysql2/issues/950

    For Rails 4.x please pin the gem to mysql2 '~> 0.4.0' to avoid the 0.5.x upgrade.

    Gemfile:

    gem 'rails', '4.2.8'
    gem 'mysql2', '~> 0.4.0'
    

    Then run bundle update rails mysql2

    I am currently using mysql v 8.0.11

提交回复
热议问题