MySQL: 'user'@'hostname' vs 'user'@'IPaddress' I needed an user to be able to log in on our MySQL server 5.6 from machine foobarhost, IP 10.11.12.13. 

Therefore I created a user 'joe'@'foobarhost' but he was unable to log in.  I had to create an user 'joe'@'10.11.12.13' and this time worked fine.

My question: how does MySQL handle hostnames vs IP addresses concerning users?  

MySQL sorts the user table before checking for a match, using IP addresses and hostnames as the most-specific values to match to.  However, the docs do not specify what takes precedence - hostname or IP.  Does MySQL attempt a hostname resolution and, if it fails, performs a check on the IP?  

What is the recommended usage for the user table: specify only IP addresses, hostnames, or both (as I did in the example above)?
I had this problem before, and after long investigation I found out sometimes MySQL can not resolve any issue related to DNS by default, so I did the following: edited hosts file ( can be found under Linux /etc/hosts, for Windows C:\Windows\System32\drivers\etc\hosts) and added ip and hostname for the client machine,in your example its 

10.11.12.13 foobarhost


then save and close ( note Windows will require reboot before taking any effect), you may need to add the following parameters --skip-name-resolve and\or --skip-host-cache .