Solution 1:
Another possible cause is when MySQL 8 users are not configured with the native password plugin.
You can fix this by running:
ALTER USER 'jeffrey'@'localhost'
IDENTIFIED WITH mysql_native_password
BY 'password';
This resolves the issue. I encountered it during a fresh WordPress install—the credentials looked correct, but WordPress kept failing to connect.
Enabling debugging revealed the actual error:
<?php
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );
?>
The message was: “The server requested authentication method unknown to the client”.
This adjustment fixed the problem. Hopefully, it saves someone else the trouble!