解决:mysql is blocked because of many connection errors;

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://01000.blog.51cto.com/2410614/1564528

环境:centos 6.5,mysql 5.6.19

问题:

在用telnet l0.0.1.120 3306数据库时,报错

kHost 'l0.0.1.120' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'Connection closed by foreign host.


原因:是同一IP的connection errors超出默认的最大值了。

解决方法1最简单的方法

重启mysql服务即可。

解决方法2:最简单的方法

通过命令行进行mysql控制台

flush hosts;


解决方法3:

修改默认的max_connect_errors连接数(mysql 5.6以上默认是100)

显示默认连接数:show variables like '%max_connect_errors%';

修改连接数为500:set global max_connect_errors = 500; (基本上同一IP不可能超过500)

flush privileges;

service mysql restart

原文地址:https://www.cnblogs.com/lxwphp/p/7731226.html