ubuntu

mysql2 gem error after upgrading MySQL database

After upgrading to MySQL 5.6 from 5.5 we started getting an error: Incorrect MySQL client library version!

After upgrading to MySQL 5.6 from 5.5 we started getting an error:

Incorrect MySQL client library version!

This gem was compiled for 5.5.17 but the client library is 5.6.58. (RuntimeError)

Solution is pretty simple - reinstalling mysql2 gem.

The tricky part is how to do that.

bundle show mysql2

returned

... shared/bundle/ruby/2.2.0/gems/mysql2-0.3.18

After Uninstalling mysql2 gem bundle show still located the gem.

gem uninstall mysql2

Here is the trick

bundle exec gem uninstall mysql2

And don’t worry about the error:

ERROR: While executing gem ... (NoMethodError) undefined methoddelete’`

This is Rails after all. Just do bundle show mysql2 again to see that the gem was actually removed.

And finally:

bundle install

Subscribe to The infinite monkey theorem

Get the latest posts delivered right to your inbox