Skip to content

mysql2 bug when using win 11 #1388

@tareilly

Description

@tareilly

Problem with Ruby gem mysql2 with windows ll
libmysql.dll in \ruby\bin
mysql client c (8.0.40)
mysql2 version (0.5.6)
ruby version 3.3.6 (2024-11-05 revision 75015d4c1f) [x64-mingw-ucrt]

Single line ruby program:
require 'mysql2'

Fault:
internal:C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb:136:in `require': Incorrect MySQL client library version! This gem was compiled for 10.8.8 but the client library is 3.4.1. (RuntimeError)

Program crashes. Mysql client is 8.0. not 10.8.8, client library is 8.0.4 not 3.4.1

From lines ~ 1545 - 1550 in mysql2-0.5.6\mysq2\ext\client.c
if (lib[i] != MYSQL_LINK_VERSION[i]) {
rb_raise(rb_eRuntimeError, "Incorrect MySQL client library version! This gem was compiled for %s but the client library is %s.", MYSQL_LINK_VERSION, lib);
}

lib[i] and MYSQL_LINK_VERSION are miscomputed. The gem appears to have a bug when run on Win 11.
I commented this section and the gem now works fine on Win 11 after altering client.c and rebuilding and reinstalling the gem. I had no problem with Win 10
I don't know enough about MYSQL linkages to fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions