Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Authentication Plugin Issues on macOS

Tags:

mysql

I’m working on a blog project using Python and Flask, and I’m using the MySQL database from XAMPP for user registration. The project worked perfectly on my Windows machine, but after switching to macOS, I’ve been encountering various issues with the registration process. I’ve managed to resolve most of the issues, but I’m still struggling with one particular error. I’ve been working on this for a week now and could use some help.

Error Details:

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

enter image description here

Context:

•   The application is running on macOS using XAMPP.
•   The database is configured correctly, and I can connect to it using other tools.
•   I’ve tried various solutions like asking chatgpt or searching on google

Has anyone encountered this issue or have any suggestions on how to resolve it?

Thanks in advance for your help!

like image 787
dogualagoz Avatar asked Nov 23 '25 19:11

dogualagoz


1 Answers

You need to install [email protected] or [email protected] on MacOS. Because native authentication plugin was removed from mysql 9.0

Run the command line below to uninstall [email protected]

  1. brew uninstall mysql

Run the command lines below to install [email protected]

  1. brew install [email protected]

  2. ln -s /opt/homebrew/opt/[email protected] /opt/homebrew/opt/mysql

  3. If you need to have mysql first in your PATH, run: echo 'export PATH="/opt/homebrew/opt/mysql/bin:$PATH"' >> ~/.zshrc

  4. source ~/.zshrc

like image 75
Leon D Avatar answered Nov 26 '25 11:11

Leon D



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!