null, message from server: "Host 'xxx' is blocked because of many connection errors; unblock
Host is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts’ 解决方法
环境:centos7,mysql8
错误:Host is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts’
原因:
同一个ip在短时间内产生太多(超过mysql数据库max_connection_errors的最大值)中断的数据库连接而导致的阻塞;
解决方法:
1、提高max_connection_errors数量:
(1)、临时解决(重启后恢复):修改max_connection_errors的数量为1000: set global max_connect_errors=1000;
查看是否修改成功:SHOW GLOBAL VARIABLES LIKE ‘%max_connect_errors%’;
(1)、永久修复:修改my.ini中max_connection_errors=1000。重启服务永久生效
2、使用mysqladmin flush-hosts 命令清理一下hosts文件(临时应急处理);
mysqladmin flush-hosts -h iphost -P port -u root -prootpasswd;
备注:
也可以mysql -uroot -prootpasswd 在数据库中执行命令:flush hosts;
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了