0 votes
1.4k views
in General by

Cannot login to mysql from Cpanel. Throwing the following error.

mysqli_connect(): (28000/1045): Access denied for user 'username'@'localhost' (using password: YES)

The server requested authentication method unknown to the client.

Warning: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in D:\xampp\htdocs\reg\server.php on line 10

2 Answers

0 votes
by

This is usually because of the authentication plugin of your mysql database

By default, mysql 8 default plugin is auth_socket. Applications will most times expect to log in to your database using a password.

If you have not yet already changed your mysql default authentication plugin, you can do so by:
1. Log in as root to mysql
2. Run this sql command:

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

Replace 'password' with your root password. In case your application does not log in to your database with the root user, replace the 'root' user in the above command with the user that your application uses.

0 votes
by

Just change your cpanel password and it will work.

If the option checkbox for updating the mysql password is also present , check that also while updating the cpanel password.

Related questions

0 votes
1 answer 1.1k views
0 votes
1 answer 1.4k views
0 votes
1 answer 981 views
0 votes
1 answer 1.2k views
asked Aug 2, 2016 in Joomla by Justin
0 votes
1 answer 1.2k views
asked Jul 29, 2016 in Phalcon by Robin
...