Read more

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."

Tobias Kraze
July 29, 2022Software engineer at makandra GmbH

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

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

Use

gem 'mysql2', git: 'https://github.com/makandra/mysql2', branch: '0.2.x-lts' # for Rails 2.x
gem 'mysql2', git: 'https://github.com/makandra/mysql2', branch: '0.3.x-lts' # for Rails 3.x

in your Gemfile, and do a

bundle update mysql2

Background

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.

Posted by Tobias Kraze to makandra dev (2022-07-29 13:40)