Mysql client can't resolve host

ERROR 2005 (HY000): Unknown MySQL server host '' (-1)

If your mysql client software --everything including gui and cli tools-- dies with the previous error after asking for a password, then you either have a DNS problem (most likely) or you may have a freak issue where a line in your /etc/hosts file has gotten too long.

Thank god for mdavidn over on the ubuntu forums who figured this one out.

I got into the issue because networkmanager kept splicing my workstation hostname into my hosts file until that line got like 3000 characters long.

It was totally a crazy problem to troubleshoot, because wireshark confirmed that my local mysql-client was not even sending out any requests over the network, and reinstalling and wiping out local mysql client configuration didn't help at all.