Bobcares

Fixing mysql_native_password is not loaded in MySQL 8.4+

PDF Header PDF Footer

Quick fixes for the mysql_native_password is not loaded error in MySQL 8.4+. Our MySQL Support Team is always here to help you.

Fixing mysql_native_password is not loaded in MySQL 8.4+

If you’ve recently upgraded to MySQL 8.4 or later and your application suddenly refuses to connect, you might see an error saying mysql_native_password is mysql_native_password is not loadednot loaded. This issue is becoming common because MySQL has disabled the mysql_native_password plugin by default, affecting many older applications, PHP versions, and user accounts that still rely on it.

Let’s get straight to the fixes without wasting time.

What the Error Looks Like

Depending on the client, you might see it in different ways:

PDO:

SQLSTATE[HY000] [1524] Plugin 'mysql_native_password' is not loaded

MySQLi:

mysqli_sql_exception Plugin 'mysql_native_password' is not loaded.

Why It Happens and How to Fix It

  1. Plugin Disabled by Default

Cause:

In MySQL 8.4, mysql_native_password is off by default.

Fix Option 1 – Switch to caching_sha2_password (Recommended):

Use the new default authentication method for better security.

Fix Option 2 – Enable mysql_native_password:

If your application still depends on it:

Edit your MySQL configuration file (usually /etc/mysql/my.cnf or /etc/my.cnf) and under [mysqld] add:

[mysqld]
mysql_native_password=ON

Restart MySQL:

sudo systemctl restart mysql
  1. User Accounts Still Using Deprecated Plugin

Cause:

Old accounts are set with mysql_native_password.

Fix:

Log in to MySQL:

mysql -u root -p

Run:

ALTER USER '<USERNAME>'@'<HOST>' IDENTIFIED WITH caching_sha2_password BY '<PASSWORD>';
  1. PHP Version Too Old

Cause:

PHP older than 7.4 doesn’t support caching_sha2_password.

Fix:

ChALTER eck PHP version:

php -v

Upgrade if needed:

sudo apt update
sudo apt install phpX

Replace X with 7.4 or higher.

  1. Misconfigured MySQL Client

Cause:

The client is set to use mysql_native_password.

Fix:

Connect explicitly with:

mysql --default-auth=caching_sha2_password -u <username> -p
  1. Connection Timeout Issues

Cause:

Long processes drop the connection.

Fix:

In MySQL config file:

[mysqld]
wait_timeout=28800
interactive_timeout=28800

Restart:

sudo systemctl restart mysql
  1. Wrong Credentials

Cause:

Incorrect username/password.

Fix:

Check details or reset password:

ALTER USER '<USERNAME>'@'<HOST>' IDENTIFIED BY '<NEW_PASSWORD>';
  1. Server Configuration Errors

Cause:

Startup options disabling required plugins.

Fix:

Check how MySQL is started and review parameters. Update config and restart if needed.

How to Avoid This Error in Future

  • First, Keep MySQL and PHP updated.
  • Then watch MySQL release notes for authentication changes.
  • Afterward use caching_sha2_password for new accounts.
  • Then test configuration changes in a safe environment first.

[If needed, Our team is available 24/7 for additional assistance.]

Conclusion

The mysql_native_password is not loaded problem is easy to solve if you follow the right commands and know where to look. A couple of quick configuration changes, or switching to the recommended authentication plugin, can get your database connections working again in minutes.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Get featured on the Bobcares blog and share your expertise with a global tech audience.

WRITE FOR US
server management

Spend time on your business, not on your servers.

TALK TO US

Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!