ITPub博客

首页 > 数据库 > MySQL > MySQL could not be resolved: Temporary failure in name resolution报错解决方法

MySQL could not be resolved: Temporary failure in name resolution报错解决方法

原创 MySQL 作者:chenfeng 时间:2017-05-06 16:27:19 0 删除 编辑
最近几天研发总是抱怨用Navicat连接MySQL数据库和打开数据表很慢,登录数据库分析,查看错误日志:


mysql> show variables like 'log_error';
+---------------+--------------------------------+
| Variable_name | Value                          |
+---------------+--------------------------------+
| log_error     | /usr/local/mysql/data/idb3.err |
+---------------+--------------------------------+
1 row in set (0.00 sec)


查看错误日志:

[root@idb3 data]# cat /usr/local/mysql/data/idb3.err | grep failure |more
2016-05-24 16:06:44 11382 [Warning] IP address '172.31.19.113' could not be resolved: Temporary failure in name resolution
2016-05-24 16:06:47 11382 [Warning] IP address '172.31.19.113' could not be resolved: Temporary failure in name resolution
2016-05-24 16:09:00 11382 [Warning] IP address '172.31.19.113' could not be resolved: Temporary failure in name resolution
2016-05-24 16:09:03 11382 [Warning] IP address '172.31.19.113' could not be resolved: Temporary failure in name resolution
2016-05-24 16:09:14 11382 [Warning] IP address '172.31.19.113' could not be resolved: Temporary failure in name resolution
..........................................................................................................................


解决方法:
在mysql的配置文件my.cnf中
[mysqld]
节点添加下面两行


skip-host-cache
skip-name-resolve         


参数解释如下:
skip-host-cache:禁用主机名缓存
skip-name-resolve:禁用主机名解析        



然后重启MySQL数据库即可解决:
# service mysqld restart

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15498/viewspace-2138579/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
交流MySQL,PolarDB/PolarDB-X,PostgreSQL,MongoDB和Redis技术。

注册时间:2015-12-07

  • 博文量
    784
  • 访问量
    2691669