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

$ mysql -u root -h 127.0.0.1 -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?

link|improve this question

68% accept rate
feedback

1 Answer

up vote 2 down vote accepted

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

mysqladmin -u root password my_password
link|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
feedback

Your Answer

 
or
required, but never shown

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