The default MySQL 8 auth plugin is auth_socket, which causes the error "SQLSTATE[HY000] [2054] 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.


Step 1

Login to the mysql server in sudo mode as the root user and supply any required passwords.

sudo mysql -u root -p


Step 2

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 run:


Now exit the MySQL server:



Step 3

You may need to restart the mysql services for the changes to take effect:

sudo service mysql restart