Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just installed MySQL on my WinXP machine. I try to login and get this:

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

I created a database my_database in the MySQL GUI with the correct username and password. What could cause this problem?

share|improve this question
up vote 2 down vote accepted

Oh, got it, I needed to set a password like this:

mysqladmin -u root password my_password
share|improve this answer
The issue you ran into was probably because you specified the -p argument on the command line, which prompts you for a password. If you hadn't set a password during install, then the password would have been blank, and you could have accessed it via mysql -u root my_database – Matt Beckman May 5 '11 at 18:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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