Reputation: 1380
So I'm working in a Rails application that has the following in the Gemfile:
gem 'mysql2', '< 0.4'
I proceeded with the following:
From here I get
An error occurred while installing mysql2 (0.3.21), and Bundler cannot continue.
So I update it to
gem 'mysql2', '~> 0.4.10'
Run bundle install and rake db:create.
So I end up with
LoadError: Please install the mysql2 adapter:
gem install activerecord-mysql2-adapter
(can't activate mysql2 (~> 0.3.10), already activated mysql2-0.4.10. Make sure all dependencies are added to Gemfile.)Gem::LoadError: can't activate mysql2 (~> 0.3.10), already activated mysql2-0.4.10. Make sure all dependencies are added to Gemfile.
From here if I try rails console I end up with:
block (2 levels) in replace_gem': Please install the mysql2 adapter:
gem install activerecord-mysql2-adapter` (can't activate mysql2 (~> 0.3.10), already activated mysql2-0.4.10. Make sure all dependencies are added to Gemfile.) (LoadError)
So I update my gemfile to have:
gem 'mysql2', '~> 0.4.10' gem 'activerecord-mysql2-adapter'
Rails console works but rake db:migrate results in
rake aborted! NoMethodError: undefined method `accept' for nil:NilClass
And everything I've found for solutions was to remove activerecord-mysql2-adapter...and that doesn't work.
For reference I'm using: ruby 2.3.5, rails 3.2.22.5
Upvotes: 0
Views: 420
Reputation: 211740
If you're using an obsolete version of Rails (and 3.2 is extremely out of date) you'll need to use a compatible version of mysql2
. If that's 0.3.21 then:
gem 'mysql2', '~> 0.3.21'
Nothing else will work.
Upvotes: 0