今早发现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地址,去掉那些用主机名字的权限。

IP address could not be resolved: Temporary failure in name resolution的更多相关文章

  1. SpringBoot之解决云服务器VPS在所处云端集群的内网不能解析域名的问题:java.net.UnknownHostException:abc.cn: Temporary failure in name resolution

    一.起因与原因分析过程 前端小伙伴儿告诉我,说服务器崩了. 请求数据接口,接口有响应,但报的json提示指向:数据库异常错误. 遂登陆云主机查看日志,核心记录显示如下: 2018-11-09 22:1 ...

  2. 大数据学习——Linux-SSH报错:Could not resolve hostname centos02: Temporary failure in name resolution

    https://blog.csdn.net/mcb520wf/article/details/83303792 随笔异常 ssh: Could not resolve hostname centos0 ...

  3. Temporary failure in name resolution

    公司搬家,在一台测试机上执行git clone,出现错误 ssh: Could not resolve hostname **: Temporary failure in name resolutio ...

  4. ssh: Could not resolve hostname git.*****-inc.com : Temporary failure in name resolution fatal: The remote end hung up unexpectedly

    问题出现的情景:使用git pull拉取开发的代码到测试服务器,报错: ssh: Could not resolve hostname git.****-inc.com : Temporary fai ...

  5. 阿里云SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

    如果是阿里云的服务器 SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in ...

  6. 运行ntpdate报错:Temporary failure in name resolution

    一.问题报错: 忽然发现某台机器时间慢了些几分钟,之前没有搭建ntpd服务,目前都是使用的ntpdate加定时任务进行时间同步.直接执行ntpdate报错如下: # ntpdate cn.pool.n ...

  7. mycat启动报错UnknownHostException(Temporary failure in name resolution)解决方法

    重启命令 ./mycat restart 查看日志 cd logs tail -f wrapper.log 报错信息 INFO | jvm 2 | 2018/05/09 11:28:28 | Erro ...

  8. IP address could not be resolved: Name or service not known

    [root@test ~]# /usr/local/mysql/bin/mysqld2018-08-05T07:00:33.647509Z 0 [Warning] [MY-011070] [Serve ...

  9. Docker 内pip安装package报错: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'

    说来奇幻(对本菜来说, 经常遇到堪称奇幻的问题) 之前在docker里面各种安装都没问题, 也不知道什么引起的, 昨天晚上调试的时候卸载了一个包的版本,然后就安不上了. 宿主机安装依然各种流畅,唯独d ...

随机推荐

  1. Java线程:CountDownLatch 与Thread 的 join()

    需求: 主程序中需要等待所有子线程完成后 再继续任务 两种实现方式: 一种使用join() 方法:当在当前线程中调用某个线程 thread 的 join() 方法时,当前线程就会阻塞,直到thread ...

  2. springboot项目封装为docker镜像

    1.本次镜像的基础镜像是:https://www.cnblogs.com/JoeyWong/p/9173265.html 2.将打包好的项目文件放在与Dockerfile同级的目录下 3.Docker ...

  3. POJ 2084

    第一题组合数学题.可以使用递推,设1与其他各数分别连边,假设N=3;若1-4,则圆分成两部分计数,此时可以利用乘法原理.(高精度) #include <cstdio> #include & ...

  4. 树莓派学习笔记—— 源码方式安装opencv

    0.前言     本文介绍怎样在树莓派中通过编译源码的方式安装opencv,并通过一个简单的样例说明怎样使用opencv.     很多其它内容请參考--[树莓派学习笔记--索引博文] 1.下载若干依 ...

  5. 每天学点Python之comprehensions

    每天学点Python之comprehensions 推导式能够简化对数据的处理,让代码简洁的同一时候还具有非常高的可读性.这在Python中非经常见. 列表推导式 通过列表推导式能够对列表中的全部元素 ...

  6. JavaScript 没有函数重载&amp;Arguments对象

    对于学过Java的人来说.函数重载并非一个陌生的概念,可是javaScript中有函数重载么...接下来我们就进行測试 <script type="text/javascript&qu ...

  7. 火狐访问IIS出现404,而Chrome可以正常访问

    需要在web.config中的handlers中添加如下节点,保存之后,需要重启电脑. <remove name="ExtensionlessUrlHandler-Integrated ...

  8. scanf使用与运算符

    scanf接收输入 #include <stdio.h> #include <stdlib.h> // 接收用户输入的小写字母,输出大写字母 int main() { char ...

  9. IntelliJ IDEA中JAVA连接MYSQL

    1.下载mysql包 2.项目中引入mysql包 3.连接数据库,查询结果 看jdbc数据库连接类 package Facade; import java.sql.*; /** * Created b ...

  10. zzulioj--1712--Monty Hall problem(蒙提霍尔问题)

     1721: Monty Hall problem Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 186  Solved: 71 SubmitSt ...