How to fix error: "Host IP is blocked because of many connection errors"?

While working with MySQL, you may encounter this error: "Host 'IP' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'". This error indicates that numerous interrupted connection requests from the specified host have been sent to mysqld. Additionally, the quantity exceeds the system variable max connect errors.

For instance, if the max connects error number is 20. Therefore, as a security measure, mysqld automatically prevents the host from receiving any more connection requests if there have been 20 unsuccessful connection requests sans any successful connection. It stops unauthorized access from people who lack the necessary credentials. The host is only reopened for connection after the host cache is flushed.

Here are some quick fixes:

1. Verify the connection
Verify the network connection to ensure that your host is not experiencing a TCP/ IP connectivity issue.

2. Increase the value of max_connect_errors
Edit the value of max connect errors in the MySQL configuration file (my.cnf on Unix/Linux, my.ini on Windows) located under the [mysqld] tag.

For example:


Or run this query:

SET GLOBAL max_connect_errors=10000;

3. Flush host cache

If you have shell access to the server, log in and run this command -
# mysql -u root -p -e 'flush hosts'

From the SQL console, run this statement:


Try restarting the server if none of those other strategies worked. The host cache should also be cleared.



Was this answer helpful?

« Back