MySQL: Resolving MySQL error: "Authentication plugin 'caching_sha2_password' cannot be loaded"

This documentation is part of the Troubleshooting guide. You can view the complete guide here: MySQL common issues and solutions.

👋 Welcome to the Stackhero documentation!

Stackhero offers a ready-to-use MySQL cloud solution that provides a host of benefits, including:

  • Unlimited connections and transfers.
  • phpMyAdmin web UI included.
  • Effortless updates with just a click.
  • Optimal performance and robust security powered by a private and dedicated VM.

Save time and simplify your life: it only takes 5 minutes to try Stackhero's MySQL cloud hosting solution!

MySQL 8 defaults to using the caching_sha2_password authentication system. When working with older client libraries, you might encounter the error: "Authentication plugin 'caching_sha2_password' cannot be loaded". To resolve this, you can modify the default authentication method to use the MySQL native password.

In your Stackhero dashboard, navigate to the MySQL configuration section and select "MySQL native password" as the authentication plugin. This setting affects the root user and any newly created users.

For existing users (excluding the root user), you can execute the following commands using the MySQL command-line interface or phpMyAdmin:

USE mysql;
ALTER USER '<userToUpdate>'@'%' IDENTIFIED WITH mysql_native_password BY '<userPassword>';
FLUSH PRIVILEGES;