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 online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
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)