本文主要是介绍is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts',希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一.问题描述
研发跟我反映他们从某个地址访问mysql数据库报类似如下错误
ERROR 1129 (00000): #HY000Host 'aaaa' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
二.问题可能原因
该问题是从某个地址到数据库产生了过多连续的不成功的连接(因为在成功连接之前连接被中断了),详细信息该考如下官方文档中关于max_connect_errors的说明
mysql> show variables like 'max_connect_errors';
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| max_connect_errors | 500 |
+--------------------+-------+
1 row in set (0.00 sec)
2)查看研发反应的地址 是否达到了max_connect_errors限制
mysql> use performance_schema;
Database changed
mysql> select * from host_cache\G;
*************************** 1. row ***************************IP: 172.172.xxx.123HOST: xxxx.xx.xxx.comHOST_VALIDATED: YESSUM_CONNECT_ERRORS: <span style="color:#ff0000;">500 >>我们可以看到error计数已经达到设定的500次,所以从这个地址过来的连接请求会被阻塞</span>COUNT_HOST_BLOCKED_ERRORS: 18832COUNT_NAMEINFO_TRANSIENT_ERRORS: 34556COUNT_NAMEINFO_PERMANENT_ERRORS: 0COUNT_FORMAT_ERRORS: 0COUNT_ADDRINFO_TRANSIENT_ERRORS: 0COUNT_ADDRINFO_PERMANENT_ERRORS: 0COUNT_FCRDNS_ERRORS: 0COUNT_HOST_ACL_ERRORS: 0COUNT_NO_AUTH_PLUGIN_ERRORS: 0COUNT_AUTH_PLUGIN_ERRORS: 0COUNT_HANDSHAKE_ERRORS: 34809COUNT_PROXY_USER_ERRORS: 0COUNT_PROXY_USER_ACL_ERRORS: 0COUNT_AUTHENTICATION_ERRORS: 0COUNT_SSL_ERRORS: 0COUNT_MAX_USER_CONNECTIONS_ERRORS: 0
COUNT_MAX_USER_CONNECTIONS_PER_HOUR_ERRORS: 0COUNT_DEFAULT_DATABASE_ERRORS: 0COUNT_INIT_CONNECT_ERRORS: 0COUNT_LOCAL_ERRORS: 0COUNT_UNKNOWN_ERRORS: 0FIRST_SEEN: 2015-11-27 17:48:29LAST_SEEN: 2016-01-27 10:54:09FIRST_ERROR_SEEN: 2015-11-27 17:48:29LAST_ERROR_SEEN: 2016-01-27 10:54:09
mysql> flush hosts;
Query OK, 0 rows affected (0.00 sec)mysql> select * from host_cache\G;
Empty set (0.00 sec)ERROR:
No query specified
##执行flush hosts命令后 host_cache表被清空,问题解决。
这篇关于is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!