当前位置:首页 - MySql

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

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

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: 13.58.205.132 X-Real-Ip: 13.58.205.132 X-Domain: r4.com.cn X-Request: GET /art211.aspx HTTP/1.1 X-Request-Uri: /art211.aspx Connection: close Accept: */* User-Agent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com) Accept-Encoding: gzip, br, zstd, deflate