Posted 17 days ago. Visible to the public.

Fix for mysql2 error "Incorrect MySQL client library version! This gem was compiled for x.x.x but the client library is y.y.y."

This should be fixed in the latest LTS-branches of our mysql2 fork Archive , 0.2.x-lts and 0.3.x-lts.


gem 'mysql2', git: '', branch: '0.2.x-lts' # for Rails 2.x gem 'mysql2', git: '', branch: '0.3.x-lts' # for Rails 3.x

in your Gemfile, and do a

bundle update mysql2


mysql2 used to check that the client library used at runtime actually matches the one it was compiled against. However, at least on Ubuntu 22.04, the mariadb library files themselves seem to report 2 conflicting versions.

The fix simply removes that check on non-Windows platforms (as is the case in current mysql2 versions), reasoning that Linux should enforce this anyways.

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for unsupported versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2).

Owner of this card:

Tobias Kraze
Last edit:
17 days ago
by Tobias Kraze
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Tobias Kraze to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more