Bug #30243 Improper name resolution on login
Submitted: 5 Aug 2007 4:25 Modified: 7 Sep 2007 7:46
Reporter: Ryan Lowe Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.20-beta MySQL Community Server OS:Mac OS X (Darwin satan.local 8.10.1 Darwin Kernel Version 8.10.1: root:xnu-792.22.5~1/RELEASE_I386 i386 i386)
Assigned to: CPU Architecture:Any

[5 Aug 2007 4:25] Ryan Lowe
Description:
On login, if I am on the localhost, the login program does not properly resolve my hostname.  I have a user: root@satan.local (which corresponds to my local hostname)

satan:~ rlowe$ hostname
satan.local

satan:~ rlowe$ mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.1.20-beta MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select user, host, password from mysql.user;
+------+-------------+----------+
| user | host        | password |
+------+-------------+----------+
| root | localhost   |          | 
| root | satan.local |          | 
+------+-------------+----------+
2 rows in set (0.00 sec)

mysql> drop user root@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
satan:~ rlowe$ mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

How to repeat:
follow commands outlined above.
[5 Aug 2007 4:46] Valeriy Kravchuk
Thank you for a problem report. Please, try to connect as:

mysql -uroot --protocol=tcp

and inform about the results.
[5 Aug 2007 16:57] Ryan Lowe
satan:~/Desktop rlowe$ mysql -uroot --protocol=tcp
ERROR 1130 (00000): Host 'localhost' is not allowed to connect to this MySQL server

and just to verify that it's running ...

satan:~/Desktop rlowe$ telnet localhost 3306
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
BHost 'localhost' is not allowed to connect to this MySQL serverConnection closed by foreign host.
satan:~/Desktop rlowe$ telnet satan.local 3306
Trying fe80:8::201:23ff:fe45:6789...
telnet: connect to address fe80:8::201:23ff:fe45:6789: Connection refused
Trying 127.0.0.1...
Connected to satan.local.
Escape character is '^]'.
BHost 'localhost' is not allowed to connect to this MySQL serverConnection closed by foreign host.
[7 Aug 2007 7:46] Sveta Smirnova
Thank you for the feedback.

Please provide output of /path/to/MySQL/bin/resolveip satan.local
[7 Sep 2007 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[20 Apr 2010 8:52] Samir Kumar
Hi,

I am facing the same issue. MySQL is running on my server. But I am not able to login. The error is exact what is mentioned in this thread.
Please suggest the solution.