“Host is blocked because of many connection errors”问题解决
今天早上打开网站出现网站错误的情况,调出错误显示Host '1xx.xx.xxx.xxx' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts',但是过一会刷新又能正常访问,一直这样一会行一会不行。
登录后台管理系统也是登录不上,也是大概的提示语句在js脚本中,开始我想到的是不是受攻击了,上服务器查看各项指标无明显异常,因为我是阿里云,上去后台查看指标也无异常。
下面是百度上的方案,设置值重启,解决问题
环境
Linux、MySQL 5.5
报错
Host ‘hostname’ is blocked because of many connection errors; unblock with 'mysqladmi.
原因
该host上部署的服务因数据库帐号配置错误,导致短时间内连接MySQL服务失败次数超过max_connection_errors参数设定值(默认10),从而被拒绝。
解决方法
方法一:
刷新记录报错host的文件
mysqladmin -uroot -p -h192.168.1.1 flush-hosts
或
mysql>flush hosts;
注意:数据库主从服务器要确定是被哪个MySQL服务拒绝了,刷新对应的服务器即可,不确定的话就都刷新吧。
方法二:
命令进入mysql数据库将max_connection_errors参数调高到1000,也可以在my.ini文件中修改,如果没有此属性则加上即可,最后重启MySQL。
用命令查看参数并进行值设置
mysql>show variables like '%max_connection_errors%';
mysql>set global max_connect_errors = 1000;
mysql>show variables like '%max_connection_errors%';
推荐阅读
-
“Host is blocked because of many connection errors”问题解决
-
Host ‘XXXXXX’ is blocked because of many connection errors
-
Host ‘XXXXXX’ is blocked because of many connection errors
-
blocked because of many connection errors; unblock with 'mysqladmin flush-hosts
-
“Host is blocked because of many connection errors”问题解决