mysql is blocked because of many connection errors

错误信息:

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

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

方法一:通过命令行进行mysql控制台
输入 flush hosts

方法二:修改max_connect_errors连接数

mysql> set global max_connect_errors = 500;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like '%max_connect_errors%';
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| max_connect_errors | 500   |
+--------------------+-------+
1 row in set (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)


最后重启mysql服务 service mysql restart