Back to blogguides

MySQL monitoring: what the port check actually proves

2 min read

Ask ten teams how they monitor MySQL and nine of them answer "port check on 3306" or a monitoring stack they never fully configured. The port check is the right first layer. It is also where most setups stop, which is why "the database was down for an hour" still happens to people with monitoring.

What a connect check catches

The Uptriva MySQL monitor opens a TCP connection to host:3306 and measures how long that takes. Simple as it is, this catches the failures that take databases out completely:

  • mysqld crashed or was OOM-killed and nothing restarted it
  • A firewall or security group change cut off the port
  • bind-address or skip-networking was changed and the daemon only listens locally
  • The host itself is down

Connection latency is worth watching too. A database that used to accept connections in 5ms and now takes 400ms is telling you something about load or network path before it fails outright. Set a latency threshold and you get that warning early.

What it does not catch

A socket that accepts connections proves very little about MySQL itself. All of these leave the port check green:

  • max_connections is exhausted, so clients get rejected after connect
  • Credentials rotated and every app's login now fails
  • A corrupted table makes the queries your app actually runs hang
  • The disk is at 99% and the next write fails
  • Replication fell behind or stopped, and reads silently serve stale data

Some of these are database problems and some are application problems, and the distinction matters for where you look next.

The layer that actually proves it works

The question is never "is MySQL up" but "can the application do its job". An HTTP monitor on an endpoint that touches the database answers that better than any port check: a health route that runs a real SELECT 1 against the primary, or even the cheap version, an endpoint that fails when its connection pool is exhausted. If your app does not expose one, it is a five-line route that pays for itself the first time credentials expire unnoticed.

Private databases and the slow failures

Most databases should never see a public address, which makes external probes useless against them. The internal agent runs the same connect check from inside your network and also gives you the host metrics that kill databases slowly: disk filling, memory pressure, CPU. Most "MySQL died suddenly" incidents were disk-full problems for a week first.

A reasonable setup ends up looking like this: agent-side connect check on 3306 plus host metrics, an HTTP check on a database-backed endpoint, and alerts routed somewhere someone reads them. The MySQL check type is included from the Team plan. Details live at /monitoring/mysql, and the same approach applies to Postgres on its own monitor type.

FAQ

How do you monitor a MySQL server?

Start with a connect check on port 3306 to catch the daemon dying or becoming unreachable. Then monitor what depends on the database: an HTTP check on an endpoint that queries it catches failures a port check cannot, and server metrics catch the resource problems that kill databases slowly.

Does a TCP check prove MySQL is working?

No. It proves something accepts connections on the port. Authentication failures, too many connections, a corrupted table or a disk filling up can all leave the port open while the database is effectively down.

Can I monitor a database on a private network?

Yes, with an internal agent. The Uptriva agent runs inside your network and performs the same connect checks against private targets, so the database never needs a public address.

Keep reading