mysql could not be resolved: Name or service not known

问题: mysql DNS反解:skip-name-resolve

错误日志有类似警告:


1.120119 16:26:04 [Warning] IP address '192.168.1.10' could not be resolved: Name or service not known
2.120119 16:26:04 [Warning] IP address '192.168.1.14' could not be resolved: Name or service not known
3.120119 16:26:04 [Warning] IP address '192.168.1.17' could not be resolved: Name or service not known

通过show processlist发现大量类似如下的连接:

1.|592|unauthenticated user|192.168.1.10:35320|NULL|Connect| |login|NULL|
2.|593|unauthenticated user|192.168.1.14:35321|NULL|Connect| |login|NULL|
3.|594|unauthenticated user|192.168.1.17:35322|NULL|Connect| |login|NULL|

skip-name-resolve 参数的作用:不再进行反解析(ip不反解成域名),这样可以加快数据库的反应时间。

修改配置文件添加并需要重启:

复制代码代码如下:

[mysqld] 
skip-name-resolve

其实就是在[mysqld]下面一行加入skip-name-resolve重启mysql服务就可以了。

原文地址:https://www.cnblogs.com/xiaoleiel/p/8324110.html