最近几天研发总是抱怨用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 //禁用主机名解析

然后重启MySQL数据库即可解决:

# service mysqld restart