mysqli_real_connect(): (HY000/1045): Access denied for user 'phpmyadmin'@'localhost' (using password: YES)

19,452

Solution 1

I was using MaridDb solved this issue with the following

  1. sudo systemctl stop mariadb
  2. sudo mysqld_safe --skip-grant-tables --skip-networking &
  3. mysql -u root

You will see a prompt like below:

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

  1. FLUSH PRIVILEGES;

For MySQL 5.7.6 and newer as well as MariaDB 10.1.20 and newer

  1. ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

                  -----------or-----------
    

For MySQL 5.7.5 and older as well as MariaDB 10.1.20

  1. SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');

Solution 2

I've just installed LAMP on a new PC, and got the same problem.
Linux Mint 20 + MariaDB.
Password for root and phpmyadmin was already ok, but the error was still there.

Finally I discovered another configuration file, that sets the phpmyadmin password; you have to edit it:

$ sudo nano /etc/dbconfig-common/phpmyadmin.conf

set the correct password (= dbc_dbpass) for user dbc_dbuser='phpmyadmin'
Use ctrl-O to save, then ctrl-X to exit. Then launch the command:

$ sudo dpkg-reconfigure phpmyadmin

(Do NOT reinstall the DB).
In my PC il works!

Solution 3

I had a similar issue with mysql 8.0.22 and Ubunutu 20.04.3lts after installation despite setting up the phpmyadmin user during the installation it wouldn't let me in with the password I set.

I solved it by logging in at the command line using

sudo mysql

Then changed the password by the below and I could then log in

ALTER USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'new-password-here';
Share:
19,452

Related videos on Youtube

Agent Pluton
Author by

Agent Pluton

Just a noob.

Updated on June 04, 2022

Comments

  • Agent Pluton
    Agent Pluton 7 months

    the error messages

    I am doing an online course from coursera where they tolm me to install phpmyadmin.

    NOW I am a total beginner in this thing so I am not able to do much research upon that and now somehow, after I installed MySQL and phpmyadmin, in the localhost, I am getting some errors, is that common? Because the other participants in the course are not getting them. If that's fatal or will limit some of my obvious abilities, please tell me how to cure it.

    BTW If you didn't noticed the errors are:

    mysqli_real_connect(): (HY000/1045): Access denied for user 'phpmyadmin'@'localhost' (using password: YES)

    and

    Connection for controluser as defined in your configuration failed.

    Some more details:

    1. PHP version is 7.4
    2. Operating System is Ubuntu 20.04

Related