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'm telling mysql to prompt for a password but it won't acknowledge it:

mysql -h -P 3306 -u root –p

response: Access denied for user 'root@%'@'' (using password: NO)

Even when I explicitly pass the password in the connection string I get the same response:

mysql -h -P 3306 -u root –pMyPassword

response: Access denied for user 'root@%'@'' (using password: NO)

What is causing this?

share|improve this question
up vote 4 down vote accepted

You have wrong character in front of p, try to delete that character and replace it with -, you can also try using following --password=XXX, and lastly -P 3306 isn't needed unless you're using NON-standard port.

share|improve this answer
You just gotta hate those annoying unicode hyphens. – Zoredache Jul 17 '14 at 16:25
heh, just don't copy and paste)) – alexus Jul 17 '14 at 16:28
...How did it even occur to you to check this? +1 for (I assume) looking at the bytecode of his command line. – Parthian Shot Jul 17 '14 at 16:49
@parthianshot sorry to disappoint you, but I didn't look at bytecode to see it(. I just copy & paste it to my terminal, removed -h and hit enter, my answer was right there as it threats that part as name for database therefore no -p. – alexus Jul 17 '14 at 16:54
@alexus Aww... Well, still solid debugging in any case. – Parthian Shot Jul 17 '14 at 16:56

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.