work, study, life ..........

Tuesday, March 3, 2009

MySQL ERROR 1129 (00000): Host ‘XXXX’ is blocked because of many connection errors

同事在测试java程序连接MySQL,在经过测试一轮后,再次登陆MySQL,提示ERROR 1129 (00000): Host ‘im3′ is blocked because of many connection errors; unb lock with ‘mysqladmin flush-hosts’。

查了一下MySQL 官方手册:http://dev.mysql.com/doc/refman/5.0/en/blocked-host.html,

“Host ‘host_name‘ is blocked because of many connection errors.

Unblock with ‘mysqladmin flush-hosts’”

里面写到连接请求的中断数目是由mysql系统变量max_connect_errors的值决定。

max_connect_error 失败请求, mysqld假定出错(例如,有人试图入侵数据库),会持续阻挡这台主机的连接,直到你在Mysql数据库上执行 mysqladmin flush-host 指令,或者 Flush hosts语句。

mysqld默认在10次链接错误后会阻挡这个台主机,你可以像这样进行调整:

shell > /path/mysql/bin.mysqld_safe –max_connect_errors=100&

或者登录MySQL数据库:

mysql> set global max_connect_errors=100;

如果在给出的主机上你得到这样的错误信息提示,首先应该检查这台主机上是否TCP/IP连接错误。 如果你的主机网络有问题,增大max_connect_errors的值也没啥好处。

No comments: