Recently, I've upgraded PHP version to 7.4 and MySQL to 8.0.15 on my Mac OSX 10.15.2 and i came across a weird issue on database connectivity.

MySQL server starting up perfectly fine. I can connect to my Database from my terminal pretty okay. But when i try to establish some Database connection to a running application. It fails. I debug the issue and it took me some while to find a permanent fix for this. Also, to mention here, I’ve reinstalled mySQL too in this process.

The Error

The Server Requested Authentication Method unknown to the Client

The Fix

This error is actually attributed to the authentication plugin that MySQL plugin is using. By default and for some reasons, mySQL default authentication plugin is auth_socket.

Simply login to your mySQL through terminal by typing

mysql -uroot -p

and run the following command.

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

Replace someNewPassword to your password & boom it works now.!

You may also Like