When I use incorrect password to connect to mysql server, and the test count is over the max_connect_errors, and I find the Aborted_connects is also arise as the count I test, but the host is still not blocked.

So does the Aborted_connects over the max_connect_errors then host_name is blocked?


3 Answers 3


At this point, you may need to run FLUSH HOSTS and see if this unblocks.

The MySQL Documentation says this about FLUSH HOSTS:

  • Empties the host cache tables. You should flush the host tables if some of your hosts change IP address or if you get the error message Host 'host_name' is blocked. When more than max_connect_errors errors occur successively for a given host while connecting to the MySQL server, MySQL assumes that something is wrong and blocks the host from further connection requests. Flushing the host tables enables further connection attempts from the host. See Section C.5.2.6, “Host 'host_name' is blocked”. You can start mysqld with --max_connect_errors=999999999 to avoid this error message.

Why should a host get blocked to begin with ??

According to the MySQL Documentation:

If you get the following error, it means that mysqld has received many connect requests from the host 'host_name' that have been interrupted in the middle: Host 'host_name' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts' The number of interrupted connect requests permitted is determined by the value of the max_connect_errors system variable. After max_connect_errors failed requests, mysqld assumes that something is wrong (for example, that someone is trying to break in), and blocks the host from further connections until you execute a mysqladmin flush-hosts command or issue a FLUSH HOSTS statement. See Section 5.1.3, “Server System Variables”.

By default, mysqld blocks a host after 10 connection errors. You can adjust the value by starting the server like this:

shell> mysqld_safe --max_connect_errors=10000 &

If you get this error message for a given host, you should first verify that there isn't anything wrong with TCP/IP connections from that host. If you are having network problems, it does you no good to increase the value of the max_connect_errors variable.

  • It doesn't look like these errors go to the normal MySQL error log. Is there a way to see a log of host-blocking connection errors? Also I noted the "successively" above. So, just need a successful connection in between? Or, should I just ask a new question?
    – Marc L.
    Mar 28, 2018 at 20:03

One cause of such a blockage is where some random person on the host decides to do some monitoring of MySQL and sets up a telnet to the MySQL port on the remote server. With a sufficient number of telnet invocations, the host is then blocked from further access to that MySQL server. Unlike some servers, MySQL does not automatically unblock access after a reasonable amount of time: the server administrator has to knock MySQL on the head.

  • Still true 8.0.23
    – The Onin
    Jul 22, 2021 at 23:57

For what's it worth, to diagnose this issue, you can try running

select * from performance_schema.host_cache

The table should be availabe starting with 5.6. More info here. For example higher number of errors in COUNT_MAX_USER_CONNECTIONS_PER_HOUR_ERRORS vs COUNT_SSL_ERRORS may give you hint. DNS Lookups and the Host Cache The MySQL server maintains an in-memory host cache that contains information about clients: IP address, host name, and error information. The Performance Schema host_cache table exposes the contents of the host cache so that it can be examined using SELECT statements. This may help you diagnose the causes of connection problems. See Section, “The host_cache Table”.

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.