MySQL - SQLSTATE[HY000]  The server requested authentication method unknown to the client (solution)
The default MySQL 8 auth plugin is
auth_socket, which causes the error "SQLSTATE[HY000]  The server requested authentication method unknown to the client" when an application is attempting to log in to the database with a password. Let's go through the steps to fix this.
Login to the
mysql server in sudo mode as the root user and supply any required passwords.
sudo mysql -u root -p
Now run the following
ALTER USER command, replacing root with your database user and password if your password.
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Now exit the MySQL server:
You may need to restart the mysql services for the changes to take effect:
sudo service mysql restart