At work, my team have a MySQL database on a Linux 14.04 box. My team is working on changing the permissions to use hostnames rather than IPs (so that the IT team can do what they want to the network and not worry about breaking our access).
For example, there would be a user admin@10.10.xxx.xxx
that we will want to change to admin@my-ws.co.local
. I've been playing around with my user (since I have root and can still log in). After changing the user profile's host from the IP address to the Hostname, Workbench will give the error...
HOST '10.10.xxx.xxx' is not allowed to connect to this MySQL server
When I log in to the Linux box and use nslookup my-ws.co.local
, the response gives me the correct IP address, so I know there no connection issue between the box and the network. And since the response is correct, I am assuming that the internal DNS is working correctly.
Checking the performance_schema.host_cache
table, I can see that the IP 10.10.xxx.xxx
was not resolved into a host (the HOST
column is NULL
and the HOST_VALIDATED
column is YES
).
Why is MySQL unable to resolve the IP address into the correct hostname, while nslookup
works? Is there some setting in MySQL that I need to fix? Do there need to be records in the internal DNS for each workstation of my team?
There's forward lookups, like resolving an A
record, and there's reverse lookups, which involve finding a PTR
record. They're often paired together on public networks, but remember that one or more A records can point to the same IP but there should be only one reverse PTR
record. Additionally, while the PTR
record is supposed to be a resolvable address, this may not be the case, the reverse entry might be invalid or resolve to an entirely different address.
Unless you have a resolver for 10.10.in-addr.arpa
, which is not normally the case since that's a reserved address space, you cannot reverse lookup the IP back to the hostname.
With nslookup
you can test reverse mapping:
nslookup 10.10.1.1
Where that address is whatever you're trying to reverse.