How to Fix MySQL Error 1129 (ER_HOST_IS_BLOCKED)
You get mysql error 1129 when a client machine sends too many failed login attempts. You can fix it by clearing the host cache and repairing the broken network path. MySQL tracks this issue using the symbol ER_HOST_IS_BLOCKED and the SQLSTATE code HY000. The server stops talking to the client IP address to protect itself from network attacks. When the error counter hits the limit, the database blocks that host right away. A complete login resets the error count for that specific IP address back
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You get mysql error 1129 when a client machine sends too many failed login attempts. You can fix it by clearing the host cache and repairing the broken network path.
MySQL tracks this issue using the symbol ER_HOST_IS_BLOCKED and the SQLSTATE code HY000. The server stops talking to the client IP address to protect itself from network attacks. When the error counter hits the limit, the database blocks that host right away. A complete login resets the error count for that specific IP address back to zero.
What causes mysql error 1129 in production
The database engine keeps an in-memory host cache to watch incoming client traffic. This cache counts how many times a host fails to finish the network handshake. Note that bad passwords alone do not always trigger this specific host block. Instead, the counter goes up when a network packet drops during the initial handshake.
Load balancers and port scanners are the most common cause of this failure. A load balancer often opens a raw TCP socket just to check server health. It then closes the socket without sending a valid MySQL login packet. The database counts every single health check as an interrupted login error. Soon, thedatabase blocks the load balancer IP address, and all app traffic stops.
Firewalls and unstable networks also cause these broken handshakes in cloud setups. If a firewall drops packets mid-stream, the server waits until the network timer expires. It then logs a handshake failure against the client IP address in the cache. Container setups with shared NAT gateways make this problem much worse for engineering teams. Many apps share one outbound IP, so their small network errors add up fast.
How to diagnose and fix the host block
To restore service right away, an admin must clear the internal host cache. You must log in from a local socket or an unblocked IP address first. Then, run the standard MySQL admin command to flush the host table in memory. This action resets all error counters to zero and lets blocked machines log in.
Flushing the cache only buys you time until the counter fills up again. Next, you need to check the internal performance tables that show the host cache. These system tables tell you which IP addresses have high handshake error counts. They also show the exact reason the last handshake failed on the wire.
MySQL Access Governance + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Once you find the noisy host, look at what runs on that machine. If it is a load balancer, change its health check to use full logins. Or, tell the database to ignore health check IPs by adjusting your network rules. Do not just raise the maximum error limit to a huge number in production. That hides real network loss and weakens your defense against brute-force port scans.
Preventing host blocks across shared networks
Teams often hit this error when engineers run local database tools over unstable Wi-Fi. When a laptop drops off a VPN during a login, the error count rises. If all engineers share one VPN gateway IP, one bad laptop blocks the team. You can stop this by putting a stable proxy inside the database network.
A local proxy holds steady TCP pools to the database over the internal network. User laptops talk to the proxy, so Wi-Fi drops never hit the database engine. You can also apply data masking at this layer to rewrite emails in query results. This setup keeps the host cache clean while protecting sensitive card numbers and phone numbers.
Add wire guardrails and masking beside MySQL
Database grants and TLS setup decide who can reach MySQL. Even so, an open session can run broad updates or read raw personal data from allowed tables. In practice, hoop.dev sits inline in the wire protocol beside the database as a sidecar for your MySQL. On every production query an agent or engineer sends, hoop.dev decides to pass, mask, block, or escalate it for human review.
With hoop.dev MySQL support, guardrails refuse bad queries before they run or hold risky calls for approval, while data masking rewrites matched sensitive values in result rows in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for GDPR, HIPAA, and PCI DSS programs. Read the docs and source on GitHub.
Frequently asked questions
Does a bad password trigger ER_HOST_IS_BLOCKED?
In most setups, a normal wrong password does not add to the host error counter. The counter tracks broken network packets, handshake timeouts, and sudden socket drops before login completes.
Will restarting the database clear the blocked hosts?
Yes, a restart wipes the in-memory host cache and unblocks every single IP address. Still, flushing the host cache online is much safer because it causes zero downtime.
Why did my whole app go down when one worker failed?
Your app workers likely sit behind a shared NAT gateway or one load balancer. The database sees one IP address and blocks all workers when that IP fails.
Related guides
In this post