Solution:1
One other scenario that causes this is due to Mysql8 users that are not set to have native password. You may have to do something as simple as
ALTER USER ‘jeffrey’@’localhost’
IDENTIFIED WITH mysql_native_password
BY ‘password’;
and this will fix the issue. Just ran into it with a fresh WP install, and could not figure out why the credentials looked correct, but WP would keep saying it could not connect. Finally enabled debug:
define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_DISPLAY’, true );
and this showed the actual error that was happening: “The server requested authentication method unknown to the client”.
Hope this helps someone!