PHPMyAdmin error requested authentication method unknown to the client [caching_sha2_password]

Whilst trying to install or use PHPMyAdmin, you might encounter the following errors:

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

The reason why this happens is because of authentication method changes in later version of MySQL.

TL;DR

Change

<span class="pun">#</span><span class="pln"> mysql </span><span class="pun">-</span><span class="pln">u root </span><span class="pun">-</span><span class="pln">pPASSWORD</span>

First syntax (depends on version of MySQL):

mysql> ALTER USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'user_password';

or

<span class="pln">mysql</span><span class="pun">></span> <span class="kwd">ALTER</span> <span class="kwd">USER</span><span class="pln"> root IDENTIFIED </span><span class="kwd">WITH</span><span class="pln"> mysql_native_password </span><span class="kwd">BY</span> <span class="str">'PASSWORD'</span><span class="pun">;</span>

There are other ways of doing this as well, so be sure to follow the reference below if you want the complete story.

Reference:
https://stackoverflow.com/questions/49948350/phpmyadmin-on-mysql-8-0

Share this article

3 thoughts on “PHPMyAdmin error requested authentication method unknown to the client [caching_sha2_password]”

Leave a Reply

Your email address will not be published.

Scroll to Top