今早发现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. php安装redis扩展 windows

    官方php_redis.dll 找了很久,感谢热心的网友,这是php官方的 php_redis.dll http://windows.php.net/downloads/pecl/releases/r ...

  2. C/C++ 名正则言顺

    本系列文章由 @yhl_leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/50532701 名称所表达的含义极其丰富 ...

  3. C#-C#6.0新特性

    来自为知笔记(Wiz)

  4. jsoup抓取网页+具体解说

    jsoup抓取网页+具体解说 Java 程序在解析 HTML 文档时,相信大家都接触过 htmlparser 这个开源项目.我以前在 IBM DW 上发表过两篇关于 htmlparser 的文章.各自 ...

  5. Okio简化处理I/O操作原理

    转载:http://blog.csdn.net/sbsujjbcy/article/details/50523623 Okio库是一个由square公司开发的,它补充了java.io和java.nio ...

  6. JavaScript-4.4函数递归之阶乘举例---ShinePans

    <html> <head> <meta http-equiv="content-type" content="text/html;chars ...

  7. MyEclipse中安装Testng插件

    下载testng.eclipse插件 Testng相应jar包,这里使用的是5.12的版本号 直接找到myeclipse的安装文件夹,将org.testng.eclipse_5.12.0.6.jar ...

  8. jquery简介 each遍历 prop attr

    一.JQ简介 jQuery是一个快速.简洁的JavaScript框架,它封装了JavaScript常用的功能代码,提供一种简便的JavaScript设计模式,优化HTML文档操作.事件处理.动画设计和 ...

  9. Java文件(io)编程——文件字节流的使用

    案例1: 演示FileInputStream类的使用(用FileInputStream的对象把文件读入到内存) 首先要在E盘新建一个文本文件,命名为test.txt,输入若干字符 public cla ...

  10. 一个简单的MyBatis项目(应用)

    ### 1. MYBATIS简介  MYBATIS是持久层框架,大大的简化了持久层开发.  当使用MYBATIS框架时,开发人员不必再编写繁琐的JDBC代码,只需要定义好每个功能对应的抽象方法与需要执 ...