zoukankan      html  css  js  c++  java
  • MySql Host is blocked because of many connection errors 解决方法

    MySql Host is blocked because of many connection errors 解决方法
    环境:linux,mysql5.7.15

    应用日志提示错误:
    create connection error, url: jdbc:mysql://10.45.236.235:3306/db_wang?useUnicode=true&characterEncoding=UTF-8, errorCode 1129, state HY000java.sql.SQLException: null, message from server: "Host '10.30.174.183' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'"

    原因:

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

    解决方法:

    1、提高允许的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';

    2、使用mysqladmin flush-hosts 命令清理一下hosts文件

        whereis mysqladmin查找mysqladmin的路径

      使用命令修改:

               /usr/bin/mysqladmin flush-hosts -h192.168.1.121 -uroot -p

      备注:

       配置有master/slave主从数据库的要把主库和从库都修改一遍

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

  • 相关阅读:
    echo 变量不加引号出错
    linux以16进制方式查看文件
    批量删除符合条件的文件
    sed删除行
    linux用户环境变量
    脚本路径问题_dirname
    shell脚本返回字符串
    关于Unix时间戳
    grunt用来压缩前端脚本
    JAVA ThreadPoolExecutor(转)
  • 原文地址:https://www.cnblogs.com/wclwcw/p/7645298.html
Copyright © 2011-2022 走看看