>From: Bernard Fay
[mailto:bernard.fay@gmail.com]
>Sent: Wednesday, June 03, 2009
2:59 PM
>Subject: Access denied for
user 'root'@'localhost' in mysql
>
>Hi,
>
>I installed MySQL in Lenny.
>When I try to login in with mysql -u root -p, I receive :
>
>ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using
password: YES)
>
>I tried to reset the password of root by adding skip-grant-tables in my.cnf
then restart mysql.
>I could login in with mysql -u root then I ran the following commands:
>
>mysql> update user set password=password('password') where user='root';
>mysql> flush privileges;
>
>I removed skip-grant-tables from my.cnf and restarted mysqld. I still
have:
>ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using
password: YES)
>
>Any idea or clues about how to solve this issue?
>
>Thanks,
>Bernard
Two methods on the same topic.
1) What database are you using when you
login? If I remember correctly (it has been a while)
you need to declare the user table like “update
mysql.user set….” And not just “update user set…”
That may be the problem if it is trying to update the wrong table/database.
2) Maybe this is one of those multiple-ways-of-completing-the-same-task
kind of scenarios but I reset passwords like so:
SET PASSWORD FOR root@localhost=PASSWORD('MyNewPassword');
I don’t seem to have problems with
it.
Other then the password reset, your
methods seem right to me as long as you are on the localhost.
Hope this helps.
Have fun!
~Stack~