0

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

Community
  • 1
  • 1
fudge
  • 19
  • 2
  • 9

1 Answers1

1

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

sugaryourcoffee
  • 879
  • 8
  • 14
  • yes i downgraded it to 0.3.18 like a lot of people said to. I tried changing mysql2 gem to 0.3.20 and when I run bundle upgrade mysql2: Could not find command "upgrade". – fudge Oct 12 '15 at 18:48
  • 1
    here is a pastebin of what my output to that command looks like: http://pastebin.com/3gFuGzEP – fudge Oct 14 '15 at 04:46
  • You need to just run `bundle` – claptimes Oct 14 '15 at 17:43
  • "You are trying to install in deployment mode after changing your Gemfile. Run `bundle install` elsewhere and add the updated Gemfile.lock to version control." - This shows up if you have deployed your code and changed the Gemfile on the deployment machine. If you are on your development machine follow the instructions bundle is suggesting. – sugaryourcoffee Oct 14 '15 at 18:02
  • @sugaryourcoffee thank you so much i didnt know this was a development machine and now i feel silly, the answer was in front of me for so long! claptimes thank you too both you guys responded and helped me out a lot. have a great day! – fudge Oct 14 '15 at 18:38