I have a server in my room on my LAN. I just rebooted my server and now when I try to connect to mysql I get the following error message

mysql -u root -p -h localhost
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I haven't changed any settings to my knowledge and was able to log in and out until I rebooted my computer. Any advice? I know this same error message has been reported on stackoverflow and serverfault, but in the Q/A's I read they aren't connecting to localhost.

5 Answers 5


The procedure is about the same; restart MySQL in safe mode log in with root and no password and perform a password reset. From there do a data integrity check.


Here is the list of steps I followed to solve this problem (from http://24x7servermanagement.com/blog/?p=44)

#service mysqld stop or
#killall mysqld
#/usr/bin/mysqld_safe –skip-grant-tables&
mysql>use mysql;

Change the MySQL admin(root) Password using following command

mysql>update user set password=password(‘wsarxaffa’) where user=’root’ and host=’localhost’;

Flush the privileges so everything will take (It removes any privileges set by the server)

mysql>flush privileges;
/etc/init.d/mysqld stop
/etc/init.d/mysqld start
mysql -u root -p

I faced this problem as well on ubuntu. In my case, the reason was that the /tmp folder was not accessible and install process was silently failing in root user creation. I'd uninstall mysql, give /tmp the right permissions and then reinstall mysql.

Please refer http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=545741


I've seen this happen when mysql has been upgraded, and the grant tables were updated.

I would run /usr/bin/mysql_upgrade (or wherever the path is on your system) to fix that.

mysqld needs to be running.


After 3 days trying i realized that there is an extension on mysql website for Win(x64). It worked for me. Exclude all from the bin folder of the original installer and copy the files from the extension.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.