当前位置:首页 - MySql

mysql错误 IP address 'xxxx' could not be resolved: Name or service not known

作者:高景洋 日期:2022-03-13 15:25:26 浏览次数:1445

mysql日志显示[Warning] IP address 'xxxx' could not be resolved: Name or service not known,那是因为mysql默认会反向解析DNS,对于访问者Mysql不会判断是hosts还是ip都会进行dns反向解析,频繁地查询数据库和权限检查,这大大增加了数据库的压力,导致数据库连接缓慢,严重的时候甚至死机,出现“连接数据库时出错”等字样。

解决办法:禁用dns反查即可

进入/etc 找到mysql的配置文件my.cnf(linux环境下)或者my.ini(windows环境下)进行编辑加入如下一行即可:

[mysqld]
skip-name-resolve

本文永久性链接:
<a href="http://r4.com.cn/art211.aspx">mysql错误 IP address 'xxxx' could not be resolved: Name or service not known</a>
当前header:Host: r4.com.cn X-Host1: r4.com.cn X-Host2: r4.com.cn X-Host3: 127.0.0.1:8080 X-Forwarded-For: 18.97.9.175 X-Real-Ip: 18.97.9.175 X-Domain: r4.com.cn X-Request: GET /art211.aspx HTTP/1.1 X-Request-Uri: /art211.aspx Connection: close User-Agent: CCBot/2.0 (https://commoncrawl.org/faq/) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 If-Modified-Since: Sun, 16 Jun 2024 11:11:49 GMT Accept-Encoding: br,gzip