Bug #23257 mysql reports "access denied" when server is not found
Submitted: 13 Oct 2006 12:45 Modified: 27 Jul 2007 7:41
Reporter: Michael Stillwell Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[13 Oct 2006 12:45] Michael Stillwell
Description:
The mysql client appears to produce the same error message in both when the username/password is invalid and if the client cannot connect to the server.

e.g.

$ mysql -h localhost -P 9999
ERROR 1045 (28000): Access denied for user 'author'@'localhost' (using password: NO)

mysql is not in fact running on this port:

$ telnet localhost 9999
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

This makes debugging very difficult!

How to repeat:
Attempt to connect to a port that does not in fact have a mysql server running on it:

$ mysql -h localhost -P 9999
ERROR 1045 (28000): Access denied for user 'author'@'localhost' (using password: NO)

Suggested fix:
The mysql client should report different error messages in the case of there being no mysql server running on a particular port, or at least not suggest that there is a username/password problem.
[27 Jul 2007 7:41] Sveta Smirnova
Thank you for the report.

I can not repeat described behaviour:

$ mysql -h localhost -P 9999 -uddd
ERROR 1045 (28000): Access denied for user 'ddd'@'localhost' (using password: NO)

$ mysql -h 127.0.0.1 -P 9999 -uddd
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (61)

Please read also about The MySQL Access Privilege System at http://dev.mysql.com/doc/refman/5.0/en/privilege-system.html