mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client code example

Example 1: mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]

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

Example 2: The server requested authentication method unknown to the client

CREATE USER 'seuUsuario'@'localhost' IDENTIFIED WITH mysql_native_password BY 'suaSenha';
GRANT ALL PRIVILEGES ON . TO 'seuUsuario'@'localhost' WITH GRANT OPTION;

Tags:

Sql Example