How to fix CR_AUTH_PLUGIN_CANNOT_LOAD (2059): Authentication plugin cannot be loaded in MySQL

MySQLINTERMEDIATEMEDIUMUpdated Dec 22, 2025ยท 302 views

Error 2059 occurs when MySQL client cannot locate or load a required authentication plugin library. This typically happens with caching_sha2_password after MySQL 8.0 changes or when the plugin directory is misconfigured.

Quick fix

Fixes CR_AUTH_PLUGIN_CANNOT_LOAD (2059): Authentication plugin cannot be loaded

SELECT user, host, plugin FROM mysql.user WHERE user = 'your_username';
  1. Verify which authentication plugin is required
  2. Update your MySQL client libraries
  3. Change user to mysql_native_password authentication
  4. Specify the plugin directory explicitly
mysql โ€” error
SELECT user, host, plugin FROM mysql.user WHERE user = 'your_username';
CR_AUTH_PLUGIN_CANNOT_LOAD (2059): Authentication plugin cannot be loaded

What this error means

Error 2059 (CR_AUTH_PLUGIN_CANNOT_LOAD) indicates that the MySQL client cannot load a required authentication plugin. This is a client-side error that occurs when the shared library file for an authentication plugin (such as caching_sha2_password, mysql_native_password, or dialog plugins) cannot be found or accessed by the client application. The error became particularly common after MySQL 8.0 changed the default authentication plugin from mysql_native_password to caching_sha2_password. Many older client libraries and applications were not built with support for the newer authentication method. Additionally, MySQL 9.0 removed mysql_native_password from built-in methods, converting it to a dynamically loadable plugin, which can cause this error if the plugin file is missing. The MySQL client searches for plugin libraries in specific directories, and if the installation is in a non-standard location or the plugin directory is not correctly configured, the client will fail to load the required plugin and throw this error.

Typical symptoms

  • Connection attempts fail with "Authentication plugin 'X' cannot be loaded" message
  • Error code 2059 or HY000 appears in connection errors
  • Applications that worked with older MySQL versions fail to connect after upgrade
  • MySQL Workbench or other GUI tools cannot establish connections
  • Legacy applications using older database drivers fail to authenticate

Common causes

  1. MySQL 8.0+ using caching_sha2_password while client expects mysql_native_password
  2. Plugin library file missing from the MySQL client plugin directory
  3. Outdated MySQL client libraries that do not support newer authentication plugins
  4. MySQL installed in non-standard location without specifying plugin directory
  5. MySQL 9.0+ client missing mysql_native_password plugin file (now dynamically loaded)
  6. Application using old database connectors (PHP, Python, Node.js) incompatible with caching_sha2_password

How to fix "CR_AUTH_PLUGIN_CANNOT_LOAD (2059): Authentication plugin cannot be loaded"

1Verify which authentication plugin is required

Check the authentication plugin for the user account:

sql
SELECT user, host, plugin FROM mysql.user WHERE user = 'your_username';

This shows which authentication plugin (mysql_native_password, caching_sha2_password, etc.) the user is configured to use.

2Update your MySQL client libraries

The most reliable fix is updating your database drivers and client libraries:

For Python:

bash
pip install --upgrade mysql-connector-python
# or
pip install --upgrade PyMySQL

For Node.js:

bash
npm install mysql2@latest

For PHP:

bash
# Ensure you have mysqlnd (native driver) enabled
php -m | grep mysqlnd

For Java:
Update your MySQL Connector/J to version 8.0.13 or later in pom.xml or build.gradle.

Modern connectors support caching_sha2_password authentication.

3Change user to mysql_native_password authentication

If updating clients is not possible, change the user's authentication plugin:

sql
ALTER USER 'your_username'@'your_host'
IDENTIFIED WITH mysql_native_password BY 'your_password';
FLUSH PRIVILEGES;

Replace 'your_username', 'your_host', and 'your_password' with actual values. This allows older clients to connect.

4Specify the plugin directory explicitly

If MySQL is installed in a non-standard location, specify the plugin directory:

Command line:

bash
mysql --plugin-dir=/path/to/mysql/lib/plugin -u username -p

In my.cnf or my.ini:

ini
[client]
plugin-dir=/usr/lib/mysql/plugin

Common plugin directory locations:
- Linux: /usr/lib/mysql/plugin or /usr/lib64/mysql/plugin
- macOS: /usr/local/mysql/lib/plugin
- Windows: C:\Program Files\MySQL\MySQL Server X.X\lib\plugin

5Set default authentication plugin server-wide (MySQL 8.0)

To make all new users use mysql_native_password by default, edit MySQL configuration:

In my.cnf (Linux/macOS) or my.ini (Windows):

ini
[mysqld]
default_authentication_plugin=mysql_native_password

Restart MySQL service:

bash
# Linux
sudo systemctl restart mysql

# macOS
brew services restart mysql

# Windows
net stop MySQL80
net start MySQL80

This only affects newly created users. Existing users must be altered individually.

6Install missing plugin files (MySQL 9.0+)

For MySQL 9.0+, mysql_native_password is a dynamically loadable plugin. Install it if missing:

Check if plugin file exists:

bash
# Linux/macOS
ls -la /usr/lib/mysql/plugin/authentication_ldap_simple.so
ls -la /usr/lib/mysql/plugin/mysql_native_password.so

# Windows
dir "C:\Program Files\MySQL\MySQL Server 9.0\lib\plugin\mysql_native_password.dll"

If missing, reinstall MySQL client:

bash
# Homebrew (macOS)
brew reinstall mysql-client

# APT (Ubuntu/Debian)
sudo apt-get install --reinstall mysql-client

# YUM (RHEL/CentOS)
sudo yum reinstall mysql-community-client

Advanced notes

Security Considerations:
While downgrading to mysql_native_password resolves compatibility issues, it uses less secure SHA-1 hashing compared to caching_sha2_password's SHA-256. For production environments, prioritize upgrading client libraries over downgrading authentication methods.

MySQL Workbench 8.0.40 Bug:
There is a known regression in MySQL Workbench 8.0.40 that causes authentication plugin errors. If you upgraded to this version and cannot connect, downgrade to version 8.0.38 or wait for a patched release.

Connection String Parameters:
Some drivers allow specifying the authentication plugin in the connection string:

bash
mysql://user:pass@host/db?authPlugin=mysql_native_password

Plugin Search Order:
MySQL searches for plugins in this order:
1. Directory specified by --plugin-dir option
2. Directory named by plugin_dir system variable
3. Built-in plugins (server-side only)

Docker and Containers:
When running MySQL in Docker, ensure your application container has compatible MySQL client libraries. MySQL 8.0 images use caching_sha2_password by default. You can override this:

yaml
environment:
  MYSQL_ROOT_PASSWORD: rootpass
command: --default-authentication-plugin=mysql_native_password

Testing Plugin Availability:
To check which plugins are available on your client, inspect the plugin directory or check MySQL documentation for your specific client version. Not all plugins are available on all platforms.

Frequently asked questions

What does "CR_AUTH_PLUGIN_CANNOT_LOAD (2059): Authentication plugin cannot be loa" mean?
Error 2059 (CR_AUTH_PLUGIN_CANNOT_LOAD) indicates that the MySQL client cannot load a required authentication plugin. This is a client-side error that occurs when the shared library file for an authentication plugin (such as caching_sha2_password, mysql_native_password, or dialog plugins) cannot be found or accessed by the client application. 0 changed the default authentication plugin from mysql_native_password to caching_sha2_password.
How do I fix "CR_AUTH_PLUGIN_CANNOT_LOAD (2059): Authentication plugin cannot be loa"?
Error 2059 occurs when MySQL client cannot locate or load a required authentication plugin library. This typically happens with caching_sha2_password after MySQL 8.0 changes or when the plugin directory is misconfigured.
What causes "CR_AUTH_PLUGIN_CANNOT_LOAD (2059): Authentication plugin cannot be loa"?
MySQL 8.0+ using caching_sha2_password while client expects mysql_native_password Plugin library file missing from the MySQL client plugin directory Outdated MySQL client libraries that do not support newer authentication plugins
Is the "CR_AUTH_PLUGIN_CANNOT_LOAD (2059): Authentication plugin cannot be loa" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading