brianmario / mysql2

A modern, simple and very fast Mysql library for Ruby - binding to libmysql
http://github.com/brianmario/mysql2
MIT License
2.25k stars 550 forks source link

Problem with mysql2 0.5.6 and brew mysql 8.3.0 #1358

Closed vladislavkovtun2003 closed 9 months ago

vladislavkovtun2003 commented 9 months ago

Environment: macOS Monterey v12.6 MacBook Pro on Intel i7

Updated from 8.1 to 8.3 mysql, when starting rails server/console, try to run migrations etc - it threw an error

dlopen(/Users/oladik/.rvm/gems/ruby-3.1.4/ruby/3.1.0/gems/mysql2-0.5.6/lib/mysql2/mysql2.bundle, 0x0009): Library not loaded: '/usr/local/opt/mysql/lib/libmysqlclient.22.dylib' (LoadError)
  Referenced from: '/Users/oladik/.rvm/gems/ruby-3.1.4/ruby/3.1.0/gems/mysql2-0.5.6/lib/mysql2/mysql2.bundle'
  Reason: tried: '/usr/local/opt/mysql/lib/libmysqlclient.22.dylib' (no such file),
                 '/usr/local/lib/libmysqlclient.22.dylib' (no such file),
                 '/usr/lib/libmysqlclient.22.dylib' (no such file),
                 '/usr/local/Cellar/mysql/8.3.0/lib/libmysqlclient.22.dylib' (no such file),
                 '/usr/local/lib/libmysqlclient.22.dylib' (no such file),
                 '/usr/lib/libmysqlclient.22.dylib' (no such file) - /Users/oladik/.rvm/gems/ruby-3.1.4/ruby/3.1.0/gems/mysql2-0.5.6/lib/mysql2/mysql2.bundle

I checked this file and currently I have /usr/local/Cellar/mysql/8.3.0/lib/libmysqlclient.23.dylib, but it still trying to access libmysqlclient.22.dylib by some reason

I tried gem pristine mysql2, but it doesn't help Then fully reinstall brew mysql and gem mysql2 - doesn't help Also I try to install like gem install mysql2 -- --with-mysql-dir=/usr/local/Cellar/mysql/8.3.0 - no changes

At the same time, the server itself works correctly:

% brew services
Name      Status     User   File
mysql     started    oladik ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
% mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.3.0 Homebrew

Please let me know if you need more information

vladislavkovtun2003 commented 9 months ago

It was impossible to fix so I uninstalled all versions of ruby ​​with all gems on the device and installed again