目录
方法一:提高允许的max_connection_errors数量
一、报错信息
ERROR 1129 (HY000): Host '172.x.x.x' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
二、报错原因
同一个ip在短时间内产生太多中断的数据库连接(超过mysql数据库max_connection_errors设置),导致被阻塞。
三、解决方案
首先还是要找到产生中断数据库连接的原因,如果不修复,下面的方法只是治标不治本而已。
扫描二维码关注公众号,回复:
17417380 查看本文章

方法一:提高允许的max_connection_errors数量
show variables like '%max_connection_errors%';
主从库修改max_connection_errors的数量为1000(立即生效)
set global max_connect_errors = 1000;
主从库在my.cnf中[mysqld]下添加(重启后不失效)
max_connect_errors = 1000
方法二:重置错误记录数
mysql> flush hosts;
# 或者
mysqladmin flush-hosts -h 127.0.0.1 -u root -p