I have a mysql server running. Due to the uptime is not perfect, sometimes the HTTP server is blocked when mysql server is down intermittently.

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

Currently, I have to set up a cron job to run "mysql-admin flush-hosts" to ensure my HTTP server can connect to database after the block.

My question is, how can I get certain IP (eg my HTTP Server) from being blocked by MySQL server ? Is it possible?



1 Answer 1


I have a 4-year-old post on how to schedule FLUSH HOSTS:

In that old post, I mentioned two techniques

  • TECHNIQUE #1 : Use MySQL Event (See the event code from my old post)
  • TECHNIQUE #2 : Run perl script (See the perl code from my old post)
    • Setup Parameters to Heartbeat
    • Connect to the mysqld
    • Hold DB Connection open indefinitely
    • Run FLUSH HOSTS; on the set schedule

In either case, FLUSH HOSTS; can be executed regularly.

Notwithstanding, you should be polling status variables

SELECT * FROM information_schema.global_status
WHERE variable_name LIKE '%connect%';

to monitor connections attempts, dropped connections, and thing like these.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.