Pages

Friday 16 October 2015

Solved! mysql2 (0.4.1) ain't working on rails 4.2.4!

                                   


                                      So, guys you have worked with rails with mysql and everything worked great untill you upgraded your version of rails to 4.2.4 and you got stuck connecting rails to mysql ... following error pops up "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 AciveRecord)."

and the patch i applied is i downgraded the gem mysql2 from version 0.4.1 to version 0.3.18.. and it worked!

to downngrade mysql2 add the following line in the Gemfile in place of gem 'mysql2'  like this

gem 'mysql', '~> 0.3.18'

and after that simply run bundle install !! Bundle will pull the dependencies and so in the Gemfile.lock file you will see the mysql2 version downgraded from 0.4.1 to 0.3.18! fixed.