zalyahya
zalyahya

Reputation: 153

MySQL Authentication method error - Caching SHA-2

When trying to access phpmyadmin on my localhost, I get these errors:

Cannot log in to the MySQL server

mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]

mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client

After research, I understood that I need to change the authentication method for my user's password. Which I did as per this link. I also made sure that the info in the config.inc.php file are correct. Yet, I'm still getting the same error.

I can't seem to understand:

  1. What is the current authentication method for MySQL?
  2. What should it be?
  3. How do I change it? And is it change for the whole MySQL configuration or for each user separately?

Update I noticed two things:

  1. There is "password" field in the user table, but an "authentication_string"
  2. The length of the "authentication_string" is 41. Although I set the password to 9 characters and log in using them.
    1. The "plugin"'s value is "caching_sha2_password"

Upvotes: 1

Views: 6034

Answers (1)

Isaac Bennetch
Isaac Bennetch

Reputation: 12412

It seems like MySQL changed their authentication style between releases 8.0.4 and 8.0.11. I don't really understand why such a big change would be implemented in a minor release, breaking semantic versioning, but nonetheless here we are.

There are already a PHP bug report and a phpMyAdmin bug report about this.

A previous Stackoverflow question about this came with an answer that suggested making some changes to the MySQL configuration and modifying a user account...while I haven't actually tested this and don't really endorse the changes it suggests, it seems to be the only way to get MySQL 8.0.11 to work with PHP/phpMyAdmin at this time.

Upvotes: 1

Related Questions