8

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..
karel
  • 122,292
  • 133
  • 301
  • 332

7 Answers7

13

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!

Wuijin
  • 131
  • 1
  • 3
7

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

https://stackoverflow.com/a/16747309/2955337

https://dev.mysql.com/doc/refman/5.7/en/creating-accounts.html

1

In addition to @Wuijin's instructions, I needed to created a new user called 'phpmyadmin' since it was not present.

To be sure that the phpmyadmin user exists, run this query inside MySQL CLI:

SELECT user FROM user;

If phpadmin is not present, create it:

CREATE USER 'phpmyadmin '@'localhost' IDENTIFIED BY 'password';
karel
  • 122,292
  • 133
  • 301
  • 332
Mahmoud
  • 111
1

For me the solution after uninstall of MySQL 8.0 to remplace it by MariaDB, has been to combine a part of @Wuijin answer with a part of the @Mahmoud one.

  1. open /etc/phpmyadmin/config-db.php, copy the password.

  2. connect to mysql on cli and run : CREATE USER 'phpmyadmin '@'localhost' IDENTIFIED BY '[paste password here]';. Alternatively, you can use the "privileges" tab in PHPMyAdmin to create the user.

  3. Ensure you run the following command to apply the changes flush privileges;. Execute this command either in the command line or through PHPMyAdmin.

Meloman
  • 271
  • 4
  • 9
0

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

LeonidMew
  • 2,802
0

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.

0

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.