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)?