DEV Community

Kelvin Murumba
Kelvin Murumba

Posted on

3 3

Fix PHPMyAdmin Error: requested authentication method unknown to the client [caching_sha2_password]

While installing PHPMyAdmin on your Mac OS, you might encounter the following error:

Alt Text

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
Enter fullscreen mode Exit fullscreen mode

This error happens because of the change in authentication in the later MySQL versions.

This is how to solve the above error:

  1. Make sure your MySQL Server is running

Alt Text

  1. From your terminal, login to MySQL:

sudo /usr/local/mysql/bin/mysql -u root -p

Enter the password you used to setup MySQL

  1. Run the below command from MySQL shell:

ALTER USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

OR

ALTER USER root IDENTIFIED WITH mysql_native_password BY 'password';

Replace user and password with your actual values.

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (2)

Collapse
 
leslieeeee profile image
Leslie

Have you tried ServBay.dev?
It's a much easier tool for PHP developers, providing a user-friendly experience, especially for beginners. It supports all versions of PHP, MariaDB, PostgreSQL, as well as Redis and Memcached. You can run multiple PHP instances simultaneously and switch between them effortlessly. It also offers easy updates without the need to configure environment variables. This tool has greatly simplified my PHP development and is definitely worth trying!

Collapse
 
hassan_athmani profile image
Hassan Athmani

Hello Kelvin,
Thank you for the fix, I found out that the user needs to run the command flush privileges; after performing the ALTER operation, or just restarting the MySQL server.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay