【mysql报错】MySQL host is blocked because of many connection errors; 解决方法

MySQL host is blocked because of many connection errors; 报错

环境

操作系统:Linux

数据库:mysql5.7.27

 

错误提示

jHost '10.146.5.209' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'Connection closed by foreign host.

原因

同一ip短时间之内产生太多(超过mysql数据库max_connection_errors的最大值)中断的数据库连接而导致的阻塞;

解决方法

第一种:提高允许的max_connect_errors数量(此方法不彻底)

 

    登录Mysql数据库查看max_connect_errors: show variables like 'max_connect_errors';

 

    修改max_connect_errors的数量为1000: set global max_connect_errors = 1000;

 

    查看是否修改成功:show variables like 'max_connect_errors';

 

第一种:提高允许的max_connect_errors数量

 

 

whereis mysqladmin查找mysqladmin的路径

 

  使用命令修改:

 

           /usr/bin/mysqladmin flush-hosts -h主机ip -uroot -p

 

  备注:

 

   如果是配置了主从备份的也需要都清理一遍

 

 第二步也可以在数据库中进行,登录数据库,命令如下:
        mysql> flush hosts;

 

posted @ 2019-08-26 18:15  HeiDi_BoKe  阅读(1172)  评论(0编辑  收藏  举报