5

I'm trying to figure out how to change the root password for phpmyadmin. I've tried doing this a few times using this:

$ mysql -u root -p
use mysql;
update user set password=PASSWORD("NEWPASSWORD") where User='root'

But then when I go to login using the new password or even the old password, I'm denied access. Any help is appreciated!

Pierre.Vriens
  • 1,159
  • 34
  • 15
  • 19
user48060
  • 71
  • 2

2 Answers2

2

I was able to do this by instead of doing update
update user set password=PASSWORD("newpassword") where User='root'
but using
set password = password ("newpassword");
flush privileges //optional
quit

YaSh Chaudhary
  • 215
  • 2
  • 8
user48060
  • 71
  • 2
0

Because really what you have to change is the root password of MySQL.

As a side note, I suggest you to block root from logging on phpmyadmin and only login to it using specific users with access to specific databases, unless it is strictly necessary to have root access (like, there's no console access to the DB server).

If really necessary, at least run phpmyadmin over SSL, since passing the MySQL root password over clear text connection is not very wise.

coredump
  • 12,573
  • 2
  • 34
  • 53