zoukankan      html  css  js  c++  java
  • mysql 连接出错 'mysqladmin flush-hosts'

    日志中出现

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

      

    原因:

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

    解决方法

    提高允许的max_connection_errors数量

    进入Mysql数据库查看max_connection_errors:

    show variables like '%max_connection_errors%';
    • 1

    修改max_connection_errors的数量为1000

     set global max_connect_errors = 1000;
    • 1

    或者直接进入my.cnf中配置 
    在[mysqld]下面添加

    max_connect_errors = 1000
    • 1

    然后重启mysql 
    之后可以检查此参数是否生效

    重置错误记录数

    1. 进入数据库,执行命令
    mysql> flush-hosts;
    • 1

    即可清除缓存,但是max_connect_errors的值是不会变大的,如果没有设置过此参数的话,一般默认max_connect_errors = 10,可以把参数设置的大一点,避免被锁。 
    配置有master/slave主从数据库的要把主库和从库都修改一遍。

  • 相关阅读:
    洛谷 P1141 01迷宫
    洛谷 p1443
    setw
    Fliptile
    追牛
    Dungeon Master
    vim的一些基本操作
    洛谷 p1309 瑞士轮
    洛谷 p1090 合并果子
    selenium2 WebDriver 在asp.net项目中的应用
  • 原文地址:https://www.cnblogs.com/milude0161/p/9316259.html
Copyright © 2011-2022 走看看