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

This documentation is part of the Troubleshooting guide. View the full guide here: MySQL common issues and solutions.

👋 Welcome to the Stackhero documentation!

Stackhero provides a fully managed MySQL cloud service that simplifies deployment and management for production workloads:

  • Unlimited connections and data transfers.
  • Integrated phpMyAdmin web interface for easy database management.
  • Hassle-free updates with one-click upgrades.
  • Consistent performance and strong security on a private, dedicated infrastructure.

With Stackhero, you can have a reliable MySQL database ready in just a few minutes. Spend less time on setup and maintenance, and more time building your applications. Try MySQL cloud hosting on Stackhero today.

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;