Ubuntu – ” Access denied for user ‘phptheadmin’@’localhost’ ” while installing phptheadmin

phpmyadmin

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

Best Answer

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

FLUSH PRIVILEGES;

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

FLUSH PRIVILEGES;

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

php_mysql support for apache

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

Related Question