## 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:

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

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

Or from an SQL session:

```sql
-- 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:

```sql
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:

```sql
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:**

```sql
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.
- **Check connection settings in the app:** correct host, port and credentials, sensible pool sizes, and timeouts that are not shorter than the network needs.
- **For WordPress,** confirm `DB_HOST` in `wp-config.php` matches the database server, then see [Error establishing a database connection](/articles/error-establishing-a-database-connection-wordpress-fix). For Laravel, see [SQLSTATE[HY000] [2002] Connection refused](/articles/laravel-sqlstate-hy000-2002-connection-refused-fix).

## 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 →](/bug-fix-services)** · [Queue an urgent fix](/checkout/emergency) · [See past projects](/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.
