Skip to content
SazM Fixed-price website fixes
Find a service or symptom
What needs fixing or building?

Type a symptom (e.g. 502, white screen, hacked, slow ttfb) or a service.

Use arrow keys to browse, Enter to select, and Escape to close.

20 matching options

Client Login Get a fix →

Bug Fixing · 5 min read

MySQL/MariaDB "Host is blocked because of many connection errors": $99 Fix

Fix MySQL and MariaDB "Host is blocked because of many connection errors; unblock with mariadb-admin flush-hosts": unblock safely, find the health check or scanner causing it, with a $99 fixed-price option.

Summary

"Host '203.0.113.10' is blocked because of many connection errors; unblock with 'mariadb-admin flush-hosts'" (or 'mysqladmin flush-hosts' on MySQL, error 1129) means the database server stopped accepting connections from one client address. It counted too many connection attempts from that host that broke off before the login finished, passed the max_connect_errors limit, and now refuses that host until the host cache is cleared. Your site or app shows it as "can't connect to database", "Error establishing a database connection" or a 500 error, while the database itself is still running.

This guide gives the safe unblock first, then how to find what keeps triggering it so it does not come back. If you would rather hand it over, SazM offers an affordable MySQL and MariaDB connection fix for a fixed $99 price, delivered within 48 hours, entirely in writing: no calls, no project manager, one senior developer.

Unblock the Host Now

Run this on the database server itself, or from any host that is not blocked:

# MariaDB
mariadb-admin -u root -p flush-hosts

# MySQL 5.7 and older
mysqladmin -u root -p flush-hosts

Or from an SQL session:

-- MariaDB, and MySQL before 8.0.23
FLUSH HOSTS;

-- MySQL 8.0.23 and later (FLUSH HOSTS is deprecated there)
TRUNCATE TABLE performance_schema.host_cache;

Restarting the database server also clears the block, but it drops every live connection, so flush instead. On managed databases (cloud database services, hosting panels) without root access, a restart or reboot from the provider's console is usually the only option, so read their documentation first.

Unblocking is only first aid. If nothing changes, the same source will block the host again within minutes or hours.

What Counts as a Connection Error

The counter goes up when a client opens a connection to the database port and the handshake does not complete: the client disconnects early, times out, or sends something the server does not understand. A successful connection from the same host resets the counter to zero. That is why the block usually comes from something that connects often and never logs in.

Common sources:

  • Load balancer or monitoring health checks that open a TCP connection to port 3306 and close it without logging in. Each check counts as an error.
  • The database port open to the internet. Scanners probe port 3306 all day. Each probe counts against whichever address it shows up as, and behind a proxy or NAT that can be your own app server.
  • Unstable networks or firewalls that cut connections mid-handshake, or a connect_timeout too short for a slow link.
  • Application connection pools that open and drop connections badly during deploys, restarts or traffic spikes.
  • A proxy or container network in front of the database, which makes every client look like the same address, so one noisy client blocks them all.

Find the Cause

On MySQL, and MariaDB with the Performance Schema enabled, the host cache shows who is failing and how:

SELECT IP, HOST, SUM_CONNECT_ERRORS, COUNT_HANDSHAKE_ERRORS, FIRST_ERROR_SEEN, LAST_ERROR_SEEN
FROM performance_schema.host_cache
ORDER BY SUM_CONNECT_ERRORS DESC;

Check the current limit and recent aborted connections:

SHOW GLOBAL VARIABLES LIKE 'max_connect_errors';
SHOW GLOBAL STATUS LIKE 'Aborted_connects';

If Aborted_connects climbs steadily while the site is quiet, something is connecting without logging in. Compare the timing with your health-check interval and look at the database error log for the client addresses.

Quick Fix Breakdown (DIY)

  • Fix the health check. Point it at an application health endpoint, or use a check that actually logs in (for example HAProxy's option mysql-check with a dedicated user), instead of a bare TCP probe of port 3306.
  • Close the port to the internet. Bind the server to a private address (bind-address in my.cnf), and allow 3306 only from your app servers in the firewall or security group.
  • Raise the limit moderately as a buffer, not as the fix:
SET GLOBAL max_connect_errors = 1000;

Add max_connect_errors = 1000 under [mysqld] in my.cnf (or [mariadb] in MariaDB) so it survives a restart. A very large value only hides the problem.

Hand It Over: $99 Fixed, Within 48 Hours

This error keeps coming back when only the symptom is cleared. The cause sits between the app, the network and the database configuration, and one developer who checks all three stops the cycle.

What you get for $99:

  • A fixed price agreed before work starts. One issue, one flat fee, no hourly meter.
  • Delivery within 48 hours of access, with configuration changes noted and reversible.
  • Fully written, fully async. You send the exact error, where it appears, your hosting setup and what changed recently. You get questions, progress and proof in writing. There are no calls, meetings or project managers.
  • Written proof it works: which client caused the errors, what was changed, and the connection-error count before and after.
  • Money-back guarantee if the agreed root cause cannot be resolved.
  • Safe access only: a limited SSH or database account that you can revoke. Never send passwords through the inquiry form.

Behind it: 20+ years in production (since Oct 2006) and 100+ projects in the portfolio.

Get this error fixed for $99 → · Queue an urgent fix · See past projects

Frequently Asked Questions

What does "Host is blocked because of many connection errors" mean?

The MySQL or MariaDB server counted more failed connection attempts from one client address than max_connect_errors allows, so it now refuses that address. The attempts broke off before login finished. The database is still running; only that host is blocked until the host cache is flushed.

How do I unblock a host in MySQL or MariaDB?

Run mariadb-admin flush-hosts (MariaDB) or mysqladmin flush-hosts (older MySQL), or FLUSH HOSTS; in SQL. On MySQL 8.0.23 and later use TRUNCATE TABLE performance_schema.host_cache;. Run it from the database server or another host that is not blocked.

Why does the host keep getting blocked again?

Something keeps opening connections without logging in: a load balancer health check, internet scanners hitting an open port, a flaky network, or a misbehaving connection pool. Find it in performance_schema.host_cache or the error log and fix that source.

Should I just set max_connect_errors very high?

No. A moderate increase, such as 1000, gives a buffer, but a huge value removes a useful protection and hides the real problem. Fix the health check, firewall or app settings that cause the errors.

How much does it cost to fix a MySQL "host is blocked" error?

SazM fixes one issue for a fixed $99, delivered within 48 hours, with a money-back guarantee if the agreed root cause cannot be resolved. Typical agency hourly rates are higher and open-ended, while very low marketplace gig prices rarely include root-cause diagnosis, a staging test or a guarantee.

// SazM ENGINEERING DISPATCH · PRODUCTION REMEDIATION

Senior Engineering Without Agency Overhead

// TRACK A · FIXED-PRICE FIXES (48H SLA)

Single Urgent or Speed Fix

Immediate code-level fixes with zero discovery calls. Emergency root-cause patch within 48 hours for $99, or full Core Web Vitals & speed remediation with before/after audit for $199. 100% money back if the agreed root cause cannot be fixed.

// TRACK B · SENIOR RETAINER & BUILDS

Monthly Plan or Custom Scope

Direct senior-level capacity embedded in your stack. Dedicated monthly engineering ($999/mo, 1 active task at a time, 24–48h PR delivery, pause or cancel anytime), or fixed-scope architectural milestones delivered within a 24h written quote.

✓ 20+ years engineering ✓ 100+ projects in the portfolio ✓ Fixes within 48 hours ✓ 100% money back if not fixed
1 Active Task at a Time
Requests are completed one by one in your priority order. As soon as an active task is shipped, tested, and approved, work starts immediately on your next task within our 24–48h SLA.
48h Emergency SLA
Clock starts as soon as site access details are provided. Delivered with full backup taken first, isolated staging testing, and 100% money back if not fixed.
WordPress Care Plan Scope
Weekly core and plugin updates pre-tested in staging, daily offsite encrypted backups, 24/7 uptime monitoring, and proactive security patching.
Pay Nothing Upfront
Zero upfront payment or credit card required. A 20-Year Senior Engineer diagnoses your issue, reproduces it on isolated staging, and deploys the fix. You only pay once you verify the staging reproduction or production fix.