博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
IP address could not be resolved: Temporary failure in name resolution
阅读量:6510 次
发布时间:2019-06-24

本文共 2854 字,大约阅读时间需要 9 分钟。

今早发现mysql日志中有非常多例如以下的警告:

140724 18:41:25 [Warning] IP address '172.16.18.217' could not be resolved: Temporary failure in name resolution

140724 18:41:25 [Warning] IP address '172.16.18.217' could not be resolved: Temporary failure in name resolution
140724 18:41:26 [Warning] IP address '172.16.18.217' could not be resolved: Temporary failure in name resolution
140724 18:41:26 [Warning] IP address '172.16.18.217' could not be resolved: Temporary failure in name resolution
140724 18:41:27 [Warning] IP address '172.16.18.217' could not be resolved: Temporary failure in name resolution
140724 18:41:28 [Warning] IP address '172.16.18.217' could not be resolved: Temporary failure in name resolution
140724 18:41:28 [Warning] IP address '172.16.18.217' could not be resolved: Temporary failure in name resolution
140724 18:41:28 [Warning] IP address '172.16.18.217' could not be resolved: Temporary failure in name resolution
140724 18:41:28 [Warning] IP address '172.16.18.217' could not be resolved: Temporary failure in name resolution
140724 18:44:54 [Warning] IP address '61.143.209.110' could not be resolved: Temporary failure in name resolution
140724 18:44:54 [Warning] IP address '61.143.209.110' could not be resolved: Temporary failure in name resolution
140724 18:44:54 [Warning] IP address '61.143.209.110' could not be resolved: Temporary failure in name resolution
140724 18:44:54 [Warning] IP address '61.143.209.110' could not be resolved: Temporary failure in name resolution
140724 18:44:54 [Warning] IP address '61.143.209.110' could not be resolved: Temporary failure in name resolution
140724 18:44:55 [Warning] IP address '61.143.209.110' could not be resolved: Temporary failure in name resolution
140724 18:44:55 [Warning] IP address '61.143.209.110' could not be resolved: Temporary failure in name resolution
140724 18:44:55 [Warning] IP address '61.143.209.110' could not be resolved: Temporary failure in name resolution
140724 18:44:55 [Warning] IP address '61.143.209.110' could not be resolved: Temporary failure in name resolution

问题产生的原因:

出现错误的原因是MYSQL Server在本地内存中维护了一个非本地的Client TCP cache。这个cache中包括了远程Client的登录信息,比方IP地址。hostname等信息。
假设Client连接到server后,Mysql首先会在本地TCP池中依据IP地址解析client的hostname或者反解析,假设解析不到。就会去DNS中进行解析,假设还是解析失败
就是在error log中写入这种警告信息。
解决的办法:
1.能够通过两个參数来disable这个功能,在MYSQL的配置文件里[mysqld]中增加以下的參数:
[mysqld]
--skip-host-cache
--skip-name-resolve
又一次授权,将全部訪问数据库server的授权方式都改成IP形式的。
grant all on *.* to ‘root’@’172.16.12.68’identified by ‘123456’;
2.加入授权。
将全部訪问数据库server的授权方式都改成IP形式。
不同的用户用不同的username和password。

grant all on *.* to ‘user_68’@’172.16.12.68’identified by ‘pwd_68’;
grant all on *.* to ‘user_67’@’172.16.12.67’identified by ‘pwd_67’;
....
然后去 mysql数据库以下的 user表  和db表 以下删除掉那些含有含有主机名字的权限记录。
总结:
1.要么加上
--skip-host-cache
--skip-name-resolve
使得MySQL将不再通过DNS解析地址。

2.要么在赋予权限的时候 直接用ip地址,去掉那些用主机名字的权限。

转载地址:http://ddbfo.baihongyu.com/

你可能感兴趣的文章
云存储应用Upthere获7700万美元股权债务融资
查看>>
国家互联网应急中心何世平博士主题演讲
查看>>
洗茶,你误会了多少年?
查看>>
贵阳高新区力争打造“千亿级大数据园区”
查看>>
安防众筹不止于卖产品 思维拓展刺激消费
查看>>
OpenSSH曝高危漏洞 会泄露私钥
查看>>
艾特网能获2016APCA用户满意品牌大奖
查看>>
《CCNP TSHOOT 300-135学习指南》——第2章 结构化故障检测与排除进程
查看>>
《Java EE 7精粹》—— 2.5 非阻塞I/O
查看>>
《Python数据科学实践指南》一2.2 字符串
查看>>
《R数据可视化手册》——1.1 安装包
查看>>
《iOS创意程序设计家》——导读
查看>>
spring-aop
查看>>
android RecycleView Adapter简单封装
查看>>
PgSQL · 案例分享 · 递归收敛优化
查看>>
Dart的数据库操作
查看>>
Codeforces 591 B Rebranding【Codeforces Round #327 (Div. 2)】
查看>>
命名难,难于上青天
查看>>
APUE读书笔记-05标准输入输出库(7)
查看>>
23 第一周作业
查看>>