When you receive the following error:

Host ‘host_name‘ is blocked because of many connection errors. Unblock with ‘mysqladmin flush-hosts’

Where ‘host_name’ is the connection IP address it means you are blocked for to many successive connections that were interrupted. This means that you did connect to the database successfully but it was interrupted due to a faulty network or or other external factors like the script you are currently working on.

This connection parameter is controlled by the “max_connect_errors” system variable on the MySQL server. To view the variables connect to the MySQL server and use the following MySQL statement:


You can also use SHOW VARIABLES LIKE ‘var_name’

where ‘var_name’ is the variable name you are looking for, in this case max_connect_errors

To remove this block use the following command when logged in on MySQL:

mysqladmin flush-host

Change the variable value:

You can change the “max_connect_errors” value in two ways, either for the session you are working on or globally for all connections from that point on forward.

To change it for the specific session issue the following statement once logged into MySQL:

SET max_connect_errors=value;

Where value is the value you wish to use.

To change it globally you can use:

SET GLOBAL max_connect_errors=value;

Where ‘value’ is once again the value you wish to use.