0
votes

Ok I have read countless articles on this same problem and I cannot get past this. I am new to Rails and I don't know much about what I'm doing but I get this error every time I run a rails server:

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).

require path_to_adapter
      rescue Gem::LoadError => e
        raise Gem::LoadError, "Specified '#{spec[:adapter]}' for database adapter, but the gem is not loaded. Add `gem '#{e.name}'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord)."
      rescue LoadError => e
        raise LoadError, "Could not load '#{path_to_adapter}'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.", e.backtrace
      end

What do I do? I've done everything on these two threads but nothing changes.

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

Rails: Specified 'mysql2' for database adapter but the gem is not loaded

1
Are you using a gem manager like RVM or rbenv or chruby?claptimes
@claptimes I dont know im following along with the first derek banas video and i think its just ruby, rails, and mysqlfudge
Can you try using bundle exec <command> for example bundle exec rails s?claptimes
I did bundle exec rails s and it started a rails server. In that server I still have the same problem lolfudge

1 Answers

1
votes

Had the same error with Rails 4. I have down graded mysql2 gem 0.4.x to 0.3.20 in my Gemfile. Then ran bundle upgrade mysql2