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

43,021

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!

Share:
43,021

Related videos on Youtube

islem GUESMI
Author by

islem GUESMI

Updated on September 18, 2022

Comments

  • islem GUESMI
    islem GUESMI almost 2 years

    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..
    
    • George Udosen
      George Udosen about 5 years
      Please kindly translate those text and copy and paste them into your question...
  • islem GUESMI
    islem GUESMI about 5 years
    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é.
  • sleepyhead
    sleepyhead about 5 years
    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.
  • islem GUESMI
    islem GUESMI about 5 years
    CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'phppassword'; ERROR 1396 (HY000): Operation CREATE USER failed for 'phpmyadmin'@'localhost'
  • islem GUESMI
    islem GUESMI about 5 years
    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é.
  • sleepyhead
    sleepyhead about 5 years
    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;
  • David
    David over 2 years
    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,