MYSQL ERROR 1045 (28000): Access denied

When accessing mysql from phpmyadmin, suddenly it fails, and it shows warning Error 1045, after reading some tutorial and tips, I followed instruction from and find in ubuntuforum, posted by Senior_Buckethed, then i rewrite this for reminder and the benefit for anyone else who read this:

First I stopped the mysql daemon

sudo /etc/init.d/mysql stop

then I restarted the mysql daemon process using the –skip-grant-tables option:

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

I then restart mysql client:

mysql -u root

I then used this command from the mysql prompt to be able to change password:


I now reset password with:

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

where xxxxxxxx is my password.
The instructions now tell me that since I have a root account, I should use this command to be able to connect from anywhere:

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

Once you get a successful message, flush privileges:


Then stop and restart the mysql daemon:

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

I then log into mysql with the following command:

tid@ubuntu:~$ mysql -u root -p

when it should ask you for a password. Once entered, you should be logged into mysql as root:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 47
Server version: 5.5.29-0ubuntu0.12.04.1 (Ubuntu)
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

and testing, I again enter

tid@ubuntu:~$ mysql -u root -p
Enter password:

And I log into mysql.