MySQL - Block Host 连接

有时候遇到这个错误:

1
Host 'xxx' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

可以用 root 登陆 MySQL 查询 IP 对应的连接错误数量:

1
select * from performance_schema.host_cache;

执行以下命令清空 host_cache 表,然后就可以了:

1
flush hosts;

也可以调整 max_connect_errors 来放大 block 的阈值:

1
SET PERSIST max_connect_errors = 1000;

参考资料

版权

评论