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;