How to solve “Access denied for user 'phpmyadmin'@'localhost' (using password: YES)"

La connexion au controluser tel que défini dans votre configuration a échoué.

mysqli_real_connect(): (HY000/1045): Access denied for user 'phpmyadmin'@'localhost' (using password: YES)
The connection to the controluser as defined in your configuration has failed..
1

6 Answers

I know this post is old, but here is what happened to me. I was upgrading and the phpmyadmin installer asked what the phpmyadmin user password should be, or to leave it blank to random generate a password. I hit enter without entering any password by mistake. So when I launched PHPMyAdmin, I got the error "mysqli_real_connect(): (HY000/1045): Access denied for user 'phpmyadmin'@'localhost' (using password: YES)".

To fix it, I found the "config-db.php" file in /etc/phpmyadmin/ and got the password from there. Root access to PHPMyAdmin was working, so I logged in as root to PHPMyAdmin and used the query "SET PASSWORD FOR 'phpmyadmin'@'localhost' = PASSWORD([copy and paste the password here])" and it worked!

Login to phpmyadmin as root, go to user accounts tab, click edit priveleges on line where phpmyadmin, and grant all priveleges.
Or create another user with grant all priveleges

1

With root privileges on the command line, use the mysql database create the user identified by your password, grant all select, update, delete privileges on all the databases on all the tables to the user phpmyadmin connecting from localhost, who also has grant options to give permissions to other users.

sudo mysql
use mysql;
CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'supersecretpassword';
SET PASSWORD FOR 'phpmyadmin'@'localhost' = PASSWORD('supersecretpassword');
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
4

I want to extend the answer of @Wuijin. Login as root and then go to Users accounts tab and see whether the phpmyadmin user is there or not. If there then it should work as @Wuijin said. But if not there then add a new user account as phpmyadmin user.

  • host -> localhost
  • password -> you will find the password in config-db.php file in /etc/phpmyadmin/ directory. Copy from there.
  • Finally grant all privileges.

And you will see the error message will be gone.

in addition to the @Wuijinanswer, to solve this error I have to created a new user called 'phpmyadmin' as is not present.

to be sure that phpmyadmin user exist run query inside MySQL CLI

SELECT user FROM user;

if the user is not present create new user with this name by:

CREATE USER 'phpmyadmin '@'localhost' IDENTIFIED BY 'password';

1

From config file which is present inside the phpadmin folder, make the password blank (if not), then try signing in without password. It worked for me when I tried to login in VS Code.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like