MySQL 8 server requested authentication method unknown to the client

On a server running MySQL 8 and PHP 7.3, I get the following error

[email protected]:~$ php 1.php
PHP Warning: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in /var/www/html/1.php on line 6
PHP Warning: mysqli_connect(): (HY000/2054): The server requested authentication method unknown to the client in /var/www/html/1.php on line 6
Failed to connect to MySQL: The server requested authentication method unknown to the client
[email protected]:~$

To fix this, create a user with MySQL native password.

See MySQL

Leave a Reply

Your email address will not be published. Required fields are marked *