mysql出现unblock with 'mysqladmin flush-hosts'
朋友发来消息,说一个系统应用登录的时候提示连接超时,让帮忙处理一下。
问他应用和数据库是否都正常,回复说数据库好像没有问题,但是应用日志报无法连接数据库。
数据库版本是:5.5.53
让他telnet数据库是否是通的,回复说不通,并发来了信息提示:
# telnet 8.8.9.9 3306
Trying 8.8.9.9...
Connected to 8.8.9.9.
Escape character is '^]'.
gHost 'kapp' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'Connection closed by foreign host.
可以看出,产生的原因是:
同一个ip在短时间内产生太多(超过mysql数据库max_connect_errors的最大值)中断的数据库连接而导致的阻塞
让他查看以下参数并发来结果:
> show variables like 'max_connect_errors';
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| max_connect_errors | 2 |
+--------------------+-------+
max_connect_errors是一个MySQL中与安全有关的计数器值,它负责阻止过多尝试失败的客户端以防止暴力破解密码的情况。
max_connect_errors的值与性能并无太大关系,默认是10,不知道为何改为了2。意味着如果某一客户端尝试连接此MySQL服务器,但是失败(如密码错误等等)2次 ,则MySQL会无条件强制阻止此客户端连接。
如果希望重置此计数器的值,则必须重启MySQL服务器或者执行mysql> flush hosts; 命令。当这一客户端成功连接一次MySQL服务器后,针对此客户端的max_connect_errors会清零。
如果max_connect_errors设置过小,则网页可能提示无法连接数据库服务器。
以下是解决方案,再贴一下吧。
解决方法1:修改max_connect_errors的值
(1)进入Mysql数据库查看max_connect_errors:
> show variables like '%max_connect_errors%';
(2)修改max_connect_errors的值:
> set global max_connect_errors = 100;
(3)查看是否修改成功
> show variables like '%max_connect_errors%';
解决方法2:使用mysqladmin flush-hosts 命令清理一下hosts文件
(1)在查找到的目录下使用命令修改:mysqladmin -u xxx -p flush-hosts
或者
> flush hosts;
解决方法3:重启mysqld
也可以在重启之前,在配置文件中将该参数调大。
# vi /etc/my.cnf
max_connect_errors = 100
mysql出现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 ...
- 黄聪:MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 解决方法(转)
转自:http://www.cnblogs.com/susuyu/archive/2013/05/28/3104249.html 环境:linux,mysql5.5.21 错误:Host is blo ...
- 【错误】:MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
错误:MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 解决 ...
- MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 解决方法 -摘自网络
错误:Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 原因: 同一个i ...
- MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 的解决方法
解决方法如下: 方法 1.在线修改提高允许的max_connection_errors数量: A. 登录Mysql数据库查看max_connection_errors: mysql>show ...
- (转!)MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 解决方法
不要贪快,以你的聪明,只要有耐心,什么事不成,你真的争口气,羞羞这势利的世界也好! --久节奏,慢读书 转自:https://www.cnblogs.com/susuyu/archive/2013/0 ...
- mysql连接报错 Host ‘xxx’is blocked because of many connection errors;unblock with 'mysqladmin flush-hosts'
程序无法连接MySQL,提示: null, message from server: "Host '192.168.6.68' is blocked because of many con ...
- blocked because of many connection errors; unblock with 'mysqladmin flush-hosts;MySQL在远程访问时非常慢的解决方法;MySql链接慢的解决方法
一:服务器异常:Host 'xx.xxx.xx.xxx' is blocked because of many connection errors; unblock with 'mysqladmin ...
- MySQL 出现 Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
MySQL 出现 Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 一大 ...
随机推荐
- TF:利用TF的train.Saver载入曾经训练好的variables(W、b)以供预测新的数据—Jason niu
import tensorflow as tf import numpy as np W = tf.Variable(np.arange(6).reshape((2, 3)), dtype=tf.fl ...
- 【官档整理】Visual Studio 2017 VS2017 中文离线安装包下载
[官档整理]Visual Studio 2017 VS2017 中文离线安装包下载 转 https://blog.csdn.net/fromfire2/article/details/81104648 ...
- POJ 3090 Visible Lattice Points 【欧拉函数】
<题目链接> 题目大意: 给出范围为(0, 0)到(n, n)的整点,你站在(0,0)处,问能够看见几个点. 解题分析:很明显,因为 N (1 ≤ N ≤ 1000) ,所以无论 N 为多 ...
- HDU 5592 ZYB's Game 【树状数组】+【二分】
<题目链接> 题目大意: 给你一个由1~n,n个数组成的序列,给出他们每个的前缀逆序数,现在要求输出这个序列. 解题分析: 由前缀逆序数很容易能够得到每个数的逆序数.假设当前数是i,它前面 ...
- 无可奈何的开始了jquery的“奇淫技巧”
转载请注明出处: https://home.cnblogs.com/u/zhiyong-ITNote/ 修改一个已有的项目,主要是前端方面,一般的项目后端都是处理好了的,不需要改也不能改,除非特殊需求 ...
- python基础一 ------装饰器的作用
装饰器: 本质属性:为函数增加新功能的函数,只是有个语法糖,显得高大上而已 #装饰器 #引子 计算斐波那契数列,第50 项 import time def fibonacci(num): if num ...
- DOCKER上安装HASSIO
更新源列表命令 sudo apt-get update sudo apt-get upgrade –y This is the list of packages you need to have av ...
- CCNA
- C++程序设计方法3:虚函数
向上映射与向下映射 派生类对象转换成基类对象,称为向上映射. 而基类对象转换成派生类对象,称为向下映射: 向上映射可由编译器自动完成,是一种隐式的自动类型转化: 凡是接受基类对象的地方(如函数参数)都 ...
- 劈配 [多省省选] [BZOJ5251] [网络流]
题目链接 分析: 这道题看题都看了我好久... 我们可以容易想到这道题和网络流有关. 首先,从原点向每个学员连一条流量为1的边 然后,要限制每个导师的学员,在每个导师连到汇点的时候流量限制为bi 再接 ...