MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 解决方法
2015-06-08 13:44
706 查看
转载自:/article/5269136.html
环境: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;
环境: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数据文件迁移到新硬盘分区的方法
- MySQL数据库事务隔离级别(Transaction Isolation Level)
- C API向MySQL插入批量数据的快速方法——关于mysql_autocommit
- mysql-5.6-winx64免安装版(zip版)安装配置教程
- mysql 分表的实现方法
- mysql中文显示为问号?的解决方法
- 配置hive使用mysql存储metadata metadatastore
- MYSQL问题集
- MYSQL建用户,建库,建表,授权
- 三款开源关系型数据库对比:MySQL、PostgreSQL、SQLite
- MySQL ERROR 1045 (28000): Access denied
- power designer里怎样指定auto_increment及初始值(mysql数据库)
- 关于mysql_free_result和mysql_close的解惑
- Snort:Barnyard2+MySQL+BASE 基于Ubuntu 14.04SNORT
- mysql笔记
- MySQL数据库迁移
- Mysql提示134错误
- mysql免安装版(解压版)安装方法
- MySQL备份和还原
- MySQL安全配置