unblock with ‘mysqladmin flush-hosts‘ 解决方法

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;

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-28 20:46:02       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-28 20:46:02       106 阅读
  3. 在Django里面运行非项目文件

    2024-03-28 20:46:02       87 阅读
  4. Python语言-面向对象

    2024-03-28 20:46:02       96 阅读

热门阅读

  1. PostgreSQL关系型数据库

    2024-03-28 20:46:02       48 阅读
  2. yarn的安装和使用详解

    2024-03-28 20:46:02       50 阅读
  3. 在仿真环境中进行orb_slam3建图测试

    2024-03-28 20:46:02       45 阅读
  4. 开源模型应用落地-qwen1.5-7b-chat-LoRA微调(二)

    2024-03-28 20:46:02       45 阅读
  5. 7-字串简写:前缀和+滑块思想的学习

    2024-03-28 20:46:02       45 阅读
  6. C++经典面试题目(八)

    2024-03-28 20:46:02       44 阅读
  7. 在K8S上使用Clickhouse

    2024-03-28 20:46:02       45 阅读
  8. Apache POI 设置样式

    2024-03-28 20:46:02       42 阅读
  9. BFS-蓝桥杯常用Python算法

    2024-03-28 20:46:02       38 阅读