I got " Access denied for user 'phpmyadmin'@'localhost' " in the process of installing phpmyadmin in Ubuntu 16.04

enter image description here enter image description here enter image description here enter image description here enter image description here


Seems like your permissions aren't set right for root user or you have lost your MySQL root password.

I would try resetting MySQL password for root and trying again. I guess this is the fastest way. Follow these steps

step 1

Stop the mysql demon with this command

sudo /etc/init.d/mysql stop

step 2

Start the mysql demon process with following

sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &

(at this point it's safest to disable networking)

step 3

Start the mysql client with

mysql -u root

step 4

Then run following in mysql prompt, so you are able to change any password


step 5

Then reset password with

 SET PASSWORD FOR root@'localhost' = PASSWORD('password');

step 6

In case you happen to have a mysql root account that can connect from everywhere, this is recommended

UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';

step 7

Once you receive a message indicating a succesful query, then run


step 8

Stop mysql and relaunch it with

sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start

I suppose you have these installed

web server apache


php_mysql support for apache

source: https://help.ubuntu.com/community/MysqlPasswordReset

  • I belive Your tip is good so I accept it. (but in a meantime i just press "ignore" from the last picture and login in the browser witch success) – Sruj Sep 4 '16 at 21:09

Instead of using root as user try phpmyadmin as the user name.

I had a similar problem signing into my phpmyadmin login page using root as the user, and knowing the password was correct.

I had the same access denied for user root @ localhost every time tried logging into phpmyadmin, so when I tried phpmyadmin as user name! and the password I finally managed to log into phpmyadmin

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.