[英]MySQL is not resolving IP address, but nslookup does resolve
At work, my team have a MySQL database on a Linux 14.04 box. 在工作中,我的团队在Linux 14.04机器上有一个MySQL数据库。 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).
我的团队正在努力更改使用主机名而不是IP的权限(以便IT团队可以对网络进行他们想做的事情,而不必担心破坏我们的访问权限)。
For example, there would be a user admin@10.10.xxx.xxx
that we will want to change to admin@my-ws.co.local
. 例如,会有一个用户
admin@10.10.xxx.xxx
,我们希望将其更改为admin@my-ws.co.local
。 I've been playing around with my user (since I have root and can still log in). 我一直在和我的用户玩耍(因为我已经具有root身份并且仍然可以登录)。 After changing the user profile's host from the IP address to the Hostname, Workbench will give the error...
将用户配置文件的主机从IP地址更改为主机名后,Workbench将给出错误信息。
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. 当我登录到Linux机器并使用
nslookup my-ws.co.local
,响应将为我提供正确的IP地址,因此我知道机器与网络之间没有连接问题。 And since the response is correct, I am assuming that the internal DNS is working correctly. 并且由于响应是正确的,因此我假设内部DNS正常工作。
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
). 检查
performance_schema.host_cache
表,我可以看到IP 10.10.xxx.xxx
没有解析为主机( HOST
HOST_VALIDATED
NULL
, HOST_VALIDATED
YES
)。
Why is MySQL unable to resolve the IP address into the correct hostname, while nslookup
works? 当
nslookup
工作时,为什么MySQL无法将IP地址解析为正确的主机名? Is there some setting in MySQL that I need to fix? 我需要修复MySQL中的某些设置吗? Do there need to be records in the internal DNS for each workstation of my team?
我团队中每个工作站的内部DNS中是否都需要记录?
There's forward lookups, like resolving an A
record, and there's reverse lookups , which involve finding a PTR
record. 有正向查找,例如解析
A
记录,有反向查找 ,其中涉及查找PTR
记录。 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. 它们通常在公共网络上配对在一起,但是请记住,一个或多个 A记录可以指向相同的IP,但是应该只有一个反向
PTR
记录。 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. 此外,虽然
PTR
记录应该是可解析的地址,但事实并非如此,反向条目可能无效或解析为完全不同的地址。
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. 除非您有
10.10.in-addr.arpa
的解析器, 10.10.in-addr.arpa
通常不会发生这种情况,因为这是保留的地址空间,否则您无法将IP反向查找回主机名。
With nslookup
you can test reverse mapping: 使用
nslookup
可以测试反向映射:
nslookup 10.10.1.1
Where that address is whatever you're trying to reverse. 该地址在哪里是您要撤消的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.