Reputation: 3425
I am trying to access mysql from the command line with:
mysql -u root --password password
but I get
Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Why is it saying that I'm not using a password?
Upvotes: 0
Views: 9455
Reputation: 567
I first tried to add C:\Program Files\MySQL\MySQL Server 8.0\bin
into the path (env variable), didn't work out.
It might be another reason but in my case it was all about copying and pasting the password, typing it out manually solved the issue.
Upvotes: 0
Reputation: 21047
I use the following syntax:
mysql -h [host] -u [user] -p[password]
Notice that there's no space between the -p
and the [password]
The correct syntax for what you're typing is:
mysql -h [host] -u [user] --password=[password]
(Check reference manual... it's section 4.5.1 for version 5.5)
If you're working on the same computer where MySQL is installed, you can skip the -h [host]
piece, or type -h localhost
.
Upvotes: 7