If you are encountering the issue below:
django.db.utils.OperationalError: (2059, "Authentication plugin 'mysql_native_password' cannot be loaded: dlopen(/opt/homebrew/Cellar/mysql/9.4.0_3/lib/plugin/mysql_native_password.so, 0x0002): tried: '/opt/homebrew/Cellar/mysql/9.4.0_3/lib/plugin/mysql_native_password.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/mysql/9.4.0_3/lib/plugin/mysql_native_password.so' (no such file), '/opt/homebrew/Cellar/mysql/9.4.0_3/lib/plugin/mysql_native_password.so' (no such file)")
Then the chances are you are trying to connect to a MySQL database via mysqlclient using MySQL’s mysql_native_password plugin.
Why this happens?
This happens because historically, MySQL users authenticated with the mysql_native_password plugin. However, it is older, weaker, and based on SHA-1 hashing (deprecated). In fact, it was the default in MySQL up through to version 5.7.
Newer MySQL versions (8.0+ and 9.0+) use caching_sha2_password by default and it is highly recommend to use this.
Why you see this error?
Newer MySQL builds (like Homebrew’s MySQL 8/9) don’t ship mysql_native_password.so anymore.
You should just upgrade right?
Not quite. Because if you are using DreamHost, they made modifications to their MySQL 8 configurations to provide broader support for most sites and software. The following are default settings in MySQL 8 that have been modified in DreamHost’s configuration:

What this means is that there is no point in updating your MySQL user to the the modern default of caching_sha2_password.
How can I fix it?
If you run pip list and see mysqlclient installed, it means you are trying to use this Python package as the recommended driver for Django when using MySQL.
It also means that you installed mysqlclient via pip (likely into your virtualenv) and that’s the code Django uses whenever you configure ENGINE = ‘django.db.backends.mysql’ in settings.py.
- Mysqlclient is a thin wrapper over your local MySQL client libraries.
- When you try to connect to MySQL at DreamHost, the local MySQL client library tries to load the plugin from your local system, because MySQL 8+ clients assume mysql_native_password might be a dynamic plugin.
- Homebrew’s MySQL 9.4 doesn’t include that .so file, so the connection fails even though the server supports the plugin.
To fix this, use mysql-connector-python instead by running pip install mysql-connector-python.
The other option is to downgrade to MySQL 8.x or lower as that still includes mysql_native_password.so.
How to downgrade?
brew uninstall mysql
brew install mysql@8.0
brew link --force mysql@8.0
export PATH="/opt/homebrew/opt/mysql@8.0/bin:$PATH"
If you get this error:
packages/django/db/backends/mysql/base.py", line 18, in <module> raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?
It most likely means that your current mysqlclient Python package (mysql.cpython-312-darwin.so) was compiled against the old MySQL 9 library paths.
You need to rebuild mysqlclient so it links to the MySQL 8 libraries. The most important command to run is: pip cache purge
Then run:
pip uninstall -y mysqlclient
export PATH="/opt/homebrew/opt/mysql@8.0/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/mysql@8.0/lib"
export CPPFLAGS="-I/opt/homebrew/opt/mysql@8.0/include"
pip install --no-binary :all: mysqlclient
To verify, run: python -c “import MySQLdb; print(MySQLdb.version_info)” which should print something like (2, 2, 7, ‘final’, 0). Then run: python manage.py runserver