zoukankan      html  css  js  c++  java
  • MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 解决方法

    环境:linux,mysql5.5.21

    错误:Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

    原因:

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

    解决方法:

    1、提高允许的max_connection_errors数量(治标不治本):

      ① 进入Mysql数据库查看max_connection_errors: show variables like '%max_connection_errors%';

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

      ③ 查看是否修改成功:show variables like '%max_connection_errors%';

    2、使用mysqladmin flush-hosts 命令清理一下hosts文件(不知道mysqladmin在哪个目录下可以使用命令查找:whereis mysqladmin);

      ① 在查找到的目录下使用命令修改:/usr/bin/mysqladmin flush-hosts -h192.168.1.1 -P3308 -uroot -prootpwd;

      备注:

        其中端口号,用户名,密码都可以根据需要来添加和修改;

        配置有master/slave主从数据库的要把主库和从库都修改一遍的(我就吃了这个亏明明很容易的几条命令结果折腾了大半天);

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

    注:

      我遇到的场景是,自己的应用启动就报错“MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' ”上面的解决方式只是暂时解决,后期发现别人的应用在链接我的数据库,而且数据库的密码是错误的,在mysql server端的err日志里看到了报错信息(密码错误),从而解决了问题。

  • 相关阅读:
    python学习笔记- day10-4【问题:为什么python的多线程不能利用多核CPU?】
    python学习笔记-day10-3【日志模块logging】
    python学习笔记-day10-2【多进程,多线程】
    python学习笔记-day10-01-【 类的扩展: 重写父类,新式类与经典的区别】
    day12-HTML基础之DOM操作
    day12-HTML基础之CSS
    HTTP原理
    day12-HTML
    day11-Jenkins
    day11-python学习笔记(二十六)yaml,ddt
  • 原文地址:https://www.cnblogs.com/qiumingcheng/p/5329682.html
Copyright © 2011-2022 走看看