解决ERROR 1129 (HY000): Host ‘xxx‘ is blocked because of many

本文档介绍了如何处理MySQL中由于过多连接错误导致的主机被封锁的问题,以及如何通过调整`max_connection_errors`和`max_connections`参数来优化数据库连接设置。首先,可以通过`flush hosts`命令尝试解除主机封锁。如果遇到语法错误,可以检查MySQL版本并正确设置全局变量。设置完成后,确保增大允许的最大连接错误和最大连接数,以避免未来出现类似问题。
摘要由CSDN通过智能技术生成
报错:
ERROR 1129 (HY000): Host '27.227.134.197' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
解决:
mysql> flush hosts;
如果以上报如下错,则使用下面步骤:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-hosts' at line 1
mysql> show variables like "max_connection_errors";

1.首先使用 root 登录 mysql -u root -p 或者
mysql -uroot -h39.97.49.66 -p

2.提高允许的max_connection_errors数量:

① 进入Mysql数据库查看

max_connection_errors: show variables like "max_connection_errors";

② 修改max_connection_errors的数量为1000:

set global max_connect_errors = 1000;

③ 修改 max_connections 的数量为1000 :

set global max_connections = 1000;

3.最后使用 mysql> flush-hosts; 命令清理一下hosts文件;

ERROR 1129 (HY000): Host '192.168.13.251' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 这个错误意味着由于该主机在短时间内产生了太多中断的数据库连接,导致其被阻塞了。要解除阻塞,可以使用'mysqladmin flush-hosts'命令。这个命令将清除hosts文件中的阻塞记录,使该主机能够重新连接到MySQL数据库。此外,您还可以通过提高max_connection_errors的数量来解决这个问题,这个变量定义了在一定时间内允许的最大中断连接数。您可以使用以下步骤来提高max_connection_errors的数量: 1. 使用root用户登录MySQLmysql -u root -p 2. 查看当前的max_connection_errors数量:show variables like "max_connection_errors"; 3. 修改max_connection_errors的数量为1000(或其他适当的值):set global max_connect_errors = 1000; 4. 修改max_connections的数量为1000(或其他适当的值):set global max_connections = 1000; 5. 最后,使用命令mysql> flush-hosts;来清理hosts文件中的阻塞记录。 这些步骤将帮助您解除该主机的阻塞并重新连接到MySQL数据库。请注意,这些步骤只是暂时解决问题的方法,治标不治本。为了避免这种情况再次发生,您可能需要调查并解决导致大量中断连接的根本原因。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [mysql errors:message from server: "Host 'xxx' is blocked because of many connection errors; unblock](https://blog.csdn.net/xll_csdn/article/details/79043025)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [Host is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts’](https://blog.csdn.net/qq_34709656/article/details/122131176)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值