Black Friday sale is now on! 50% off Laravel: The Modular Way. Learn more

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

David Carr

Development

    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
    

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

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

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

    Thanks to this stackoverflow post

    Laravel Modules Book by David Carr

    Help support the blog so that I can continue creating new content!

    Subscribe to my newsletter

    Subscribe and get my books and product announcements.

    © 2009 - 2022 DC Blog. All code MIT license. All rights reserved.