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..
1
  • Please kindly translate those text and copy and paste them into your question... Apr 25, 2019 at 11:41

7 Answers 7

11

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!

1
  • This worked for me. And so you know, there's nothing wrong with random password upon install - it will work fine if everything else is setup correctly from beginning. Normally, u never need to know this password. It's when you go and tinker any number of PMA's components (php versions/etc/etc), the control user or root account is always the first to complain. -> And FYI - you can change password by going to: Global "User Accounts"/"Edit privileges" (for phpmyadmin)/"Change Password" at top - instead of using sql statement.
    – B. Shea
    Dec 28, 2022 at 17:30
4

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

4
  • 1
    thx , but it does not work , againn i have the same error like : mysqli_real_connect(): (HY000/1045): Access denied for user 'phpmyadmin'@'localhost' (using password: YES) La connexion au controluser tel que défini dans votre configuration a échoué. Apr 25, 2019 at 14:19
  • mysqli is a php module to create a database connection over the network. you use the phpmyadmin user to connect to the database to create that user, or it does exist, but you don't have the correct password. So that's why I would use a terminal so that you can connect to the database to fix that problem. I now see that the command 'sudo mysql' dropped from my answer.
    – sleepyhead
    Apr 25, 2019 at 14:44
  • CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'phppassword'; ERROR 1396 (HY000): Operation CREATE USER failed for 'phpmyadmin'@'localhost' Apr 25, 2019 at 14:51
  • ERROR 1396 indicates that the user exists, to reset it's password run SET PASSWORD FOR 'phpmyadmin'@'localhost' = PASSWORD('supersecretpassword'); ... next you can do the GRANT PERMISSIONS and may be FLUSH PRIVILEGES;
    – sleepyhead
    Apr 25, 2019 at 16:52
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';
1
  • I would go further referring to another answer in your answer is useless if the other answer were to be deleted. An answer should be complete in itself and if it is no different then an answer all ready given it has no value. If the answer is not complete simply make a comment to an existing answer,
    – David
    Feb 2, 2022 at 5:32
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.

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

1
  • 1
    mysql> CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'password'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON . TO 'phpmyadmin'@'localhost' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec) ES) mysqli_real_connect(): (HY000/1045): Access denied for user 'phpmyadmin'@'localhost' (using password: YES) La connexion au controluser tel que défini dans votre configuration a échoué. Apr 25, 2019 at 15:36
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.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .