Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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

 
discard

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.