[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Fwd: Access denied for user 'root'@'localhost' in mysql



`

As fas as I understand it, there is no need to say "update mysql.user set ..."  because we have to say "use mysql" first.
So the update command should know the table user is part of mysql.  Right?

I really believe the problem comes from the fact there is know root@localhost in mysql.user.  I have only root@beryllium and debian-sys-maint@localhost.

I update the password of root@beryllium and I can login with mysql -u root@beryllium -p .

Is it a normal situation or I should have root@localhost?

Thanks for the help
Bern



On Wed, Jun 3, 2009 at 5:13 PM, Stackpole, Chris <CStackpole@barbnet.com> wrote:

>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~




Reply to: