Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
2015-12-02 19:35
736 查看
环境: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 -h 192.168.1.1 -P 3306 -u root -p rootpwd;
备注:
其中端口号,用户名,密码都可以根据需要来添加和修改;
配置有master/slave主从数据库的要把主库和从库都修改一遍的(我就吃了这个亏明明很容易的几条命令结果折腾了大半天);
第二步也可以在数据库中进行,命令如下:flush hosts;
错误: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 -h 192.168.1.1 -P 3306 -u root -p rootpwd;
备注:
其中端口号,用户名,密码都可以根据需要来添加和修改;
配置有master/slave主从数据库的要把主库和从库都修改一遍的(我就吃了这个亏明明很容易的几条命令结果折腾了大半天);
第二步也可以在数据库中进行,命令如下:flush hosts;
相关文章推荐
- MySQL 常用的UPDATE操作
- mysql的伪列
- MySQL和MsSQL实时自动同步
- 将OWL本体文件存储到MySQL数据库
- 让MySQL支持Emoji表情 mysql 5.6
- Xtrabackup与innobackupex热备份MySQL数据
- 再谈Mysql MHA
- mac mysql error You must reset your password using ALTER USER statement before executing this statement.
- MySQL 5.7.9 免安装配置
- mysql explain 解释器中的字段含义
- MySQL 的异常与事务结合的使用方法。并带自动回滚!
- MySql的简单查询不等于,NULL
- mysql5.6.17 zip安装、卸载及root密码修改
- Mysql 主从同步
- mysql执行计划Status定义
- mysql常用两种数据引擎
- mysql-存储引擎
- MySQL数据库水平切分的实现原理解析
- MYSQL 修改语句
- MySQL数据库怎么截取字符串?