About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
When one application server suddenly cannot reach MySQL, while others still can, the message may be Host 'host_name' is blocked because of many connection errors. followed by Unblock with 'mysqladmin flush-hosts'. This is error 1129. The server counts interrupted connection attempts per client host and blocks the host once the count reaches max_connect_errors (default 100). Flushing the host cache unblocks it at once, but the block returns if whatever interrupts the connections is still running.
What the error means
The MySQL 8.4 Error Reference lists error 1129 with the symbol ER_HOST_IS_BLOCKED, SQLSTATE HY000, and the message Host '%s' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'. The %s is filled in with the client host.
The server keeps an in-memory host cache with each client's IP address, host name and error information. The manual says the cache contains information about errors that occur during the connection process, and that some are considered blocking. If too many of these happen successively from one host without a successful connection, the server blocks further connections from that host.
Points from the manual that decide how you diagnose this:
max_connect_errorsis a global, dynamic variable. Its default is 100 and its minimum is 1.- If a connection from the host succeeds within fewer than
max_connect_errorsattempts after an interrupted one, the error count for that host is cleared to zero. So a host that keeps connecting successfully is not blocked by a few stray errors. - In the Performance Schema
host_cachetable,SUM_CONNECT_ERRORScounts the errors deemed blocking. The manual says only protocol handshake errors are counted, and only for hosts that passed validation (HOST_VALIDATED = YES). - The cache is not used for TCP connections over a loopback address (such as 127.0.0.1 or
::1) or for connections over a Unix socket. An administrator logged in on the database server can still connect through the socket while a remote host is blocked. - A blocked host can also become unblocked without a flush: if the cache is full and a new client IP arrives, the least recently used entry is discarded, and if that entry was a blocked host, it is unblocked.
The manual's wording on cause is that the server has received many connection requests from the host that were "interrupted in the middle", and that after max_connect_errors failed requests without a successful connection the server assumes something is wrong, for example that someone is trying to break in. A failed login has its own column (COUNT_AUTHENTICATION_ERRORS), and the host_cache page says only protocol handshake errors count towards SUM_CONNECT_ERRORS. A monitoring probe that opens a TCP connection to port 3306 and closes it without completing the MySQL handshake matches the manual's description of an interrupted connection, though the manual does not name monitoring probes.
Likely causes
| Cause | What you see | How to confirm |
|---|---|---|
| A health check or port probe that connects and drops | One host (for example a monitor or load balancer address) blocked repeatedly | host_cache shows high SUM_CONNECT_ERRORS and COUNT_HANDSHAKE_ERRORS for that IP |
| A network fault that cuts connections mid-handshake | Intermittent drops between the client and the database | Same counters, plus Connection_errors_xxx status variables, and network tests from the client |
| DNS trouble when the server resolves the client name | COUNT_NAMEINFO_* or COUNT_ADDRINFO_* counters rising, HOST_VALIDATED not YES |
Those columns in host_cache |
| Port scanning or an attack from one host | A host you do not recognise in host_cache |
The address is not one of your clients |
max_connect_errors set very low |
Blocks after a handful of errors | SHOW GLOBAL VARIABLES LIKE 'max_connect_errors'; returns a small number |
Prove the cause before changing anything
All read-only. You can run them from the server itself through the socket even while the remote host is blocked.
1. Read the setting.
SHOW GLOBAL VARIABLES LIKE 'max_connect_errors';
SHOW GLOBAL VARIABLES LIKE 'host_cache_size';
2. Read the host cache. The manual says the host_cache table "can be examined using SELECT statements".
SELECT IP, HOST, HOST_VALIDATED, SUM_CONNECT_ERRORS, COUNT_HOST_BLOCKED_ERRORS,
COUNT_HANDSHAKE_ERRORS, COUNT_AUTHENTICATION_ERRORS, FIRST_ERROR_SEEN, LAST_ERROR_SEEN
FROM performance_schema.host_cache
ORDER BY SUM_CONNECT_ERRORS DESC;
A host is blocked when its SUM_CONNECT_ERRORS has reached max_connect_errors. COUNT_HOST_BLOCKED_ERRORS counts connections refused because of the block. The manual notes that SUM_CONNECT_ERRORS can exceed max_connect_errors because simultaneous attempts can each add to the count. FIRST_ERROR_SEEN and LAST_ERROR_SEEN show when it started and whether it is still happening.
3. Check the server-wide counters. The manual says errors that happen before the client IP is known, or that are not tied to an IP, appear in the Connection_errors_xxx status variables.
SHOW GLOBAL STATUS LIKE 'Connection_errors%';
4. Identify the offending client. Match the IP in host_cache to an application server, monitor or load balancer. Look at what runs on that host every few seconds and connects to port 3306.
Fix
1. Remove the cause. Change the probe to complete a real login, or to check the port from a source you exclude, and fix the network fault. The manual's own advice is: if the message occurs, first verify there is nothing wrong with TCP/IP connections from the blocked hosts, because raising max_connect_errors does no good if there are network problems.
2. Unblock the host. Save the facts first: run the SELECT in the previous section and keep the output, because flushing erases the counters.
Risk: a flush clears the whole host cache and unblocks every blocked host, not only the one you meant, and the cache, which the manual says is there to avoid DNS lookups, starts empty, so new connections may trigger fresh lookups until it refills. It cannot be undone. Once the cause is fixed, an empty cache is normally not a problem. Back-out: none needed; if the cause is still present the host is blocked again after max_connect_errors more errors.
Then pick one of the three flush methods the manual lists:
mysqladmin flush-hosts(needs theRELOADprivilege, orDROPon thehost_cachetable).TRUNCATE TABLE performance_schema.host_cache;(needsDROPon the table).- Changing
host_cache_size(needsSYSTEM_VARIABLES_ADMIN, or the deprecatedSUPER), which triggers an implicit flush.
The manual's page for the FLUSH statement in 8.4 does not list a HOSTS option, so use one of the three methods above, for example:
mysqladmin flush-hosts
3. Only if the cause cannot be removed quickly, raise the threshold. The manual shows SET GLOBAL max_connect_errors=10000; at runtime. Save the value first:
SHOW GLOBAL VARIABLES LIKE 'max_connect_errors';
Note the value (100 unless changed).
Risk: a higher threshold means a host that really is probing or attacking the server is blocked later. Back-out: SET GLOBAL max_connect_errors = 100; using the value you noted. If you persist it with SET PERSIST, undo with RESET PERSIST max_connect_errors;.
Then run:
SET GLOBAL max_connect_errors = 10000;
4. DNS-related blocks. The manual notes that starting the server with skip_name_resolve enabled disables DNS host name lookups, and that then the server uses only IP addresses to match connecting hosts to grant-table rows, so only accounts specified with IP addresses can be used. This is a startup setting, and it breaks any account defined by host name; plan it as a change with its own test.
Risk: this setting needs a server restart, which closes every connection, and accounts defined by host name stop matching. Do not apply it as a quick fix for a block. Before any such change, copy the option file to a dated name and keep the file name so it can be restored.
Example (illustrative): at 09:12 the web tier at web01 (192.0.2.10) reports ERROR 1129. On db01 the administrator connects through the socket and runs the host_cache query. It shows IP 192.0.2.10 with SUM_CONNECT_ERRORS 100, COUNT_HANDSHAKE_ERRORS 100 and COUNT_AUTHENTICATION_ERRORS 0. In this made-up case, a shell loop on web01 opens a TCP connection to port 3306 every 5 seconds and closes it, a plain port check, which is the likely source of the interrupted handshakes. At 5 seconds each, 100 interrupted attempts take 100 × 5 = 500 seconds, a little over 8 minutes, and the application's connections were not making new logins in between to reset the count. The team replaces the loop with a check that completes a real login with a dedicated monitoring account, then runs mysqladmin flush-hosts once.
Confirm the fix
Connect from the formerly blocked host and run a simple query. Re-run the host_cache query: SUM_CONNECT_ERRORS for that host should stay at 0 or a low number, and LAST_ERROR_SEEN should stop moving. Check SHOW GLOBAL STATUS LIKE 'Connection_errors%'; for any count still climbing.
What to watch afterwards
SUM_CONNECT_ERRORSper host inhost_cache, so you see a probe starting to trip the limit before it blocks.Connection_errors_xxxstatus variables over time.- Any change to health checks, load balancer settings or network paths in front of the database.
Read next
Related articles you may want next.
- TroubleshootingMySQL ERROR 1045 (28000) "Access denied for user": which account the server matchedMySQL ERROR 1045 (28000) Access denied for user? Read the user, host and 'using password' text, find the account the server matched, then fix it.Read article
- HostingLoad-balancer health checks that mark a working application as downWhy wrong health URLs, TLS settings or deep checks cause false negatives—and how to design probes that match real user paths in steady-state hosted operations.Read article
- TroubleshootingMySQL ERROR 1040 "Too many connections": find who holds them before raising max_connectionsMySQL ERROR 1040 Too many connections? Use the reserved admin connection to see who holds them, fix the cause, then raise max_connections safely.Read article
Risks and limits
The behaviour described is from the MySQL 8.4 manual. A flush hides the history you need to find the cause, so record the table first. Raising max_connect_errors reduces protection against repeated bad connections. The manual does not say which client programs produce interrupted connections, so the monitoring-probe explanation is a likely match, not a documented rule. These commands have not been run or lab-tested.
Sources
- Server Error Reference — Oracle, MySQL 8.4 Error Reference, no date shown, accessed 20 November 2026
- 7.1.12.3 DNS Lookups and the Host Cache — Oracle, MySQL 8.4 Reference Manual, no date shown, accessed 20 November 2026
- 29.12.22.3 The host_cache Table — Oracle, MySQL 8.4 Reference Manual, no date shown, accessed 20 November 2026
- 7.1.8 Server System Variables (max_connect_errors) — Oracle, MySQL 8.4 Reference Manual, no date shown, accessed 20 November 2026
- 15.7.7.37 SHOW STATUS Statement — Oracle, MySQL 8.4 Reference Manual, no date shown, accessed 20 November 2026
- 6.5.2 mysqladmin — A MySQL Server Administration Program — Oracle, MySQL 8.4 Reference Manual, no date shown, accessed 20 November 2026
- 15.7.8.3 FLUSH Statement — Oracle, MySQL 8.4 Reference Manual, no date shown, accessed 20 November 2026
- 15.7.6.1 SET Syntax for Variable Assignment — Oracle, MySQL 8.4 Reference Manual, no date shown, accessed 20 November 2026
- 7.1.9.3 Persisted System Variables — Oracle, MySQL 8.4 Reference Manual, no date shown, accessed 20 November 2026
- B.3.2.9 Communication Errors and Aborted Connections — Oracle, MySQL 8.4 Reference Manual, no date shown, accessed 20 November 2026
This article was originally published on .