Tags

If you’ve encounter an error like this:

$ bundle exec rake db:create db:migrate
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).
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:177:in `rescue in spec'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:174:in `spec'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:50:in `establish_connection'
C:in `establish_connection'

Solution:
Add this line in your Gemfile
gem ‘mysql2’, ‘~> 0.3.20’

App environments that the error above will occured:
ruby -v: ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]
mysql -v: mysql Ver 14.14 Distrib 5.7.16, for Win64 (x86_64)

Advertisements