How Do I Fix “Host is blocked because of many connection error” In MySQL

by lifeLinux on February 23, 2013

Today, I got following MySQL error in a PHP application: Host ‘host_name’ is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts’. It means that mysqld has received many connection requests from the given host. Default max_connect_errors value is 10, that is remote host will be blocked if there is more than 10 connection errors.

To fix, type the following command

# mysqladmin flush-hosts

To avoid this happening again, edit my.cnf

# vi /etc/my.cnf

Add the following line

max_connect_errors=10000

The value of the max_connect_errors system variable determines how many successive interrupted connection requests are permitted. Restart MySQL to reload configuration file

# service mysqld restart

Or, the value ‘max_connect_errors’ can also be set at runtime, type the following commands

# mysql -uroot -p
# mysql> SET GLOBAL max_connect_errors=10000;

Related Posts:

Leave a Comment

Previous post:

Next post: