mysql错误日志报IP address '' could not be resolved: Nam
mysql错误日志报IP address '' could not be resolved: Nam在工作中出现这样的问题,研发和测试同事在连接mysql的时候,突然mysql连接断开,每天都会出现1-2次
错误日志内容
2014-04-08 17:58:11 24636 [Warning] IP address '192.168.1.116' could not be resolved: Name or service not known
2014-04-08 17:58:24 24636 [Warning] IP address '192.168.1.109' could not be resolved: Name or service not known
2014-04-08 18:00:26 24636 [Warning] IP address '192.168.1.46' could not be resolved: Name or service not known
2014-04-08 18:00:41 24636 [Warning] IP address '192.168.1.103' could not be resolved: Name or service not known
2014-04-09 10:03:00 24636 [Warning] IP address '192.168.1.102' could not be resolved: Name or service not known
2014-04-09 10:04:20 24636 [Warning] IP address '192.168.1.115' could not be resolved: Name or service not known
这个错误日志表示mysql对ip地址进行dns解析,解决的办法就是修改my.cnf配置文件取消dns解析
[mysqld]
skip-name-resolve
在Linux下配置文件/etc/my.cnf(搜索出来)
在windows下配置文件是MySQL安装目录下的my.ini文件。
注意该配置是加在 [mysqld]下面,在更改配置并保存后,然后重启mysql并远程连接测试,一切恢复如初