BLACK FRIDAY SALE IS LIVE !!!!!

Need Assistance?

In only two hours, with an average response time of 15 minutes, our expert will have your problem sorted out.

Server Trouble?

For a single, all-inclusive fee, we guarantee the continuous reliability, safety, and blazing speed of your servers.

MySQL Error-The server requested an authentication method unknown to the client

Recently some of our clients got this error when tried to connect the MySQL database.

The main cause for this error is the improper authentication settings given in MySQL.

Why a MySQL authentication plugin?

When a MySQL user tries to login (for example in PhpMyAdmin) then the authentication plugin checks that the connection is whether coming from a legitimate user.

While creating a user or altering a user using CREATE USER, GRANT, ALTER USER statements you can specify the authentication plugin using IDENTIFIED VIA clause. By default, MariaDB uses the mysql_native_password authentication method in the case without specifying the authentication plugin.

Mysql uses also caching_sha2_password and auth_socket plugins for validation.

MySQL prefers the caching_sha2_password auth method because it uses SHA-2-algorithm with 256 -bit password encryption.

In the case of using the auth_socket plugin, it authenticates clients that connect from the localhost through the Unix socket file. This auth_socket plugin checks whether the socket username matches the client program’s MySQL username to the server.

Cause of this Error :

Some of our users who are using MySQL 8 with PHP 7.0 version got this MySQL authentication unknown error.

By default, MySQL 8 uses the auth_socket MySQL authentication plugin.

When trying to access MySQL database using PHP applications (for eg: PhpMyAdmin), it will authenticate the user with the given password. If the authentication plugin type is not changed already it will throw an error message like “The server requested authentication method unknown to the client”.

Solution :

In order to fix this issue, you need to change the MySQL authentication plugin type.

For this, you have to log in to the MySQL prompt first.

mysql -u root -p

Then run the below command to change the user’s authentication plugin type ;

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

(Replace skynats and password variable with your username and password details.)

Also, you can change the MySQL authentication method in the my.cnf file.

Here our my.cnf file is located at /etc/my.cnf.

[mysqld]
default_authentication_plugin=mysql_native_password

Then run the below command in the MySQL prompt.

mysql -u root -p

mysql > flush privileges;

Then you have to restart the MySQL service in the server.

service mysqld restart

If you are facing any issue with your MySQL/ MariaDB no need to worry about it, our technical team will handle your database server issue at any time within a short span of time. Contact us.

Liked!! Share the post.

Get Support right now!

Start server management with our 24x7 monitoring and active support team

Can't get what you are looking for?

Available 24x7 for emergency support.