一 原因

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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
  • 2022-12-23
  • 2021-05-08
  • 2022-02-05
  • 2021-05-24
  • 2022-12-23
猜你喜欢
  • 2022-02-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-02
  • 2022-12-23
  • 2021-09-05
相关资源
相似解决方案