Ever got the following error message after installing MySQL on a Windows Server:
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
Sounds like this is quite a common problem if you look check in google.
This issue could have several roots:
- The MySQL Service is not running
- Service is not configured to accept network connections
- Wrong password/username
- Firewall setup
- Wrong port (standard is 3306)
The mysql help actually has some good hints for these issues:
(From my own experience, port 3306 actually does not need to be open in order to use the MySql command line tool or the MySQL Workbench.)
My service was running and configured for tcp/ip, the firewall was disabled and the port was correct. So it had to be something with the password.
You can reset the root password like this:
- Stop the MySQL service:
sc stop mysql
- Start MySQL with the –skip-grant-tables option, this disables the password checks. You might wanna start it in a different command prompt window.
- Run the following commands:
mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD(‘your_new_password’) where USER=’root’;mysql> FLUSH PRIVILEGES;
- Stop the Server:
mysqladmin -uroot -pyour_new_password shutdown
- You should be able to login now
mysql -uroot -pyour_new_password
If this does not help, there is a long discussion in the MySQL forum about this issue: