MySQL Forums
Forum List  »  Install & Repo

Re: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Posted by: Alex Tan
Date: May 22, 2007 07:28AM

I had the same problem, this solution worked for me.

First, you will need to make sure whether the default user is 'admin' or 'root' or whatever. You will then need to reset the password.

Start the mysql server instance or daemon with the --skip-grant-tables option. (security setting) You can do it by adding the "skip-grant-tables" in the server section of /etc/my.cnf then restart mysql service by #service mysql restart

Then Execute these statements.
# mysql -u root mysql
mysql> SELECT Host, User FROM mysql.user;
| Host | User |
| localhost | admin |
1 row in set (0.00 sec)
mysql> UPDATE user SET Password=PASSWORD('your_new_password') where USER='The_user_@_localhost';
mysql> quit

After that, restart the instance/daemon without the --skip-grant-tables option. (ie. modify the /etc/my.cnf AND # service mysql restart IF you follow the above)

You should be able to connect with your new password.

# mysql -u root -p OR # mysql -u admin -p
Enter password: your_new_password

Hope this helps.

Options: ReplyQuote

Written By
June 27, 2009 08:29PM
December 16, 2007 02:18AM
Re: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
May 22, 2007 07:28AM
December 27, 2007 02:08PM
January 16, 2011 06:51AM
August 27, 2009 12:22AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.