Host is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts’ 解决方法
环境:centos6.5,mysql5.1.73
错误: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;
2) 查看是否修改成功:SHOW GLOBAL VARIABLES LIKE ‘%max_connect_errors%’;
2、使用mysqladmin flush-hosts 命令清理一下hosts文件;
mysqladmin flush-hosts -h iphost -P port -u root -prootpasswd;
备注:
也可以mysql -uroot -prootpasswd 在数据库中执行命令:flush hosts;

当遇到'Host is blocked because of many connection errors'时,这表明由于频繁的连接错误,MySQL已阻止了某个IP。解决方法包括增大'max_connection_errors'的限制或使用'mysqladmin flush-hosts'命令来解锁。在CentOS 6.5和MySQL 5.1.73环境下,可以执行'mysqladmin flush-hosts -h iphost -P port -u root -prootpasswd'或直接在数据库中运行'flush hosts;'。
515

被折叠的 条评论
为什么被折叠?



