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, exceeding the system variable max_connect_errors.

For example, if the max_connect_errors value is set to 20, and there are 20 failed connection attempts without a successful one, MySQL will block further connections from that IP. This feature is a security measure to prevent unauthorized access.

The block will remain until the host cache is flushed.

Here are the steps you can follow to resolve the error. 

1. Verify the Network Connection

Ensure the server is reachable from the client machine and there are no TCP/IP connection issues.

[Ping or telnet test from client to MySQL server]

2. Increase the Value of max_connect_errors

Edit the MySQL configuration file:

On Linux, it's usually /etc/my.cnf or /etc/mysql/mysql.conf.d/mysqld.cnf

Add or modify the following under [mysqld]:

max_connect_errors = 10000

Then restart the MySQL service:

sudo systemctl restart mysql

Alternatively, you can set it temporarily via SQL:

SET GLOBAL max_connect_errors = 10000;

3. Flush the Host Cache

If you have shell access, run:

mysql -u root -p-e 'flush hosts'

Or from within the MySQL console:

FLUSH HOSTS;

Restart the MySQL Server (Optional)

If the issue persists, restarting MySQL may also clear the host cache:

sudo systemctl restart mysql

Conclusion:

This error is a safeguard against repeated failed login attempts. You can resolve it by:

  • Checking your network connectivity
  • Increasing the max_connect_errors limit
  • Flushing the host cache manually
  • Restarting the MySQL server if needed

Once the root cause is fixed and the cache is cleared, your host should be able to reconnect successfully.

Was this answer helpful? 0 Users Found This Useful (3 Votes)