Hoje aconteceu esse erro comigo: Warning: mysqli::__construct(): The server requested authentication method unknown to the client [caching_sha2_password] in XXX on line 8

Warning: mysqli::__construct(): (HY000/2054): The server requested authentication method unknown to the client in XXX on line 8
Connection failed: The server requested authentication method unknown to the client

Fui investigar o motivo e descobri que aparentemente o MySQL mudou a forma padrão de autenticação.

Para resolver, basta executar o seguinte SQL, trocando 123456 pela senha de root do MySQL:

ALTER USER 'root'@'localhost' IDENTIFIED WITH 
mysql_native_password BY '123456'; 

Fonte