🐡

Homebrew MySQL 9 Client で「mysql_native_password」読み込みエラーが出た時の対処

に公開

エラー

ERROR 2059 (HY000): Authentication plugin 'mysql_native_password' cannot be loaded: dlopen(/opt/homebrew/Cellar/mysql/9.3.0/lib/plugin/mysql_native_password.so, 0x0002): tried: '/opt/homebrew/Cellar/mysql/9.3.0/lib/plugin/mysql_native_password.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/mysql/9.3.0/lib/plugin/mysql_native_password.so' (no such file), '/opt/homebrew/Cellar/mysql/9.3.0/lib/plugin/mysql_native_password.so' (no such file)

mysql client の確認

$ which mysql
/opt/homebrew/bin/mysql
$ mysql --version
mysql  Ver 9.3.0 for macos15.2 on arm64 (Homebrew)

Homebrew で install した 9.3.0 を使っている

原因

https://dev.mysql.com/doc/refman/9.0/en/mysql-nutshell.html

Features Removed in MySQL 9.0

The following items are obsolete and have been removed in MySQL 9.0. Where alternatives are shown, applications should be updated to use them.

For MySQL 8.4 applications that use features removed in MySQL 9.0, statements may fail when replicated from a MySQL 8.4 source to a MySQL 9.0 replica, or may have different effects on source and replica. To avoid such problems, applications that use features removed in MySQL 9.0 should be revised to avoid them and use alternatives when possible.

Workaround

$ brew install mysql@8.4

して、以下を使う

 $ /opt/homebrew/opt/mysql@8.4/bin/mysql --version
/opt/homebrew/opt/mysql@8.4/bin/mysql  Ver 8.4.5 for macos15.2 on arm64 (Homebrew)

Discussion