DEV Community

David Carr
David Carr

Posted on • Originally published at dcblog.dev on

MySQL 8.0+ error: The server requested authentication method unknown to the client

MySQL 8.0+ error: The server requested authentication method unknown to the client

Upgraded MySQL to v8 and starting getting connection errors due to how MySQL 8 defaults to auth_socket connections. Applications that use passwords will fail and generate the error:

PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client

Enter fullscreen mode Exit fullscreen mode

The solution is to change the default authentication method to mysql_native_password.

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password
BY 'password';  
Enter fullscreen mode Exit fullscreen mode

Replace password with your password, if you don't use a password then enter it as ''

Thanks to this stackoverflow post

Top comments (0)