port 5432 · PostgreSQL
Port 5432 — PostgreSQL
Port 5432 is PostgreSQL's IANA-assigned default. If something's bound to 5432, it's almost certainly Postgres — local install, Docker container, or a forgotten dev database.
beginner
PostgreSQL
Find the process + connect / kill
lsof -i :5432 # COMMAND PID USER ... # postgres 1234 postgres ... # Connect: psql -h localhost -p 5432 -U postgres # Inside Docker: docker exec -it <container> psql -U postgres # Multiple Postgres versions? Usually 5432 (v17), 5433 (v16), 5434 (v15), etc.
Typical services on this port
- PostgreSQL server (Homebrew, apt, official installer)
- Postgres.app on macOS
- Docker postgres image (with `-p 5432:5432`)
- PgBouncer (connection pooler — sometimes on 5432, often 6432)
Alternatives
Common alternates: 5433, 5434, 5435 — used when running multiple Postgres versions side-by-side. PgBouncer often on 6432.
Common pitfalls
| Input | Result |
|---|---|
| ⚠ Killing port 5432 process = DROPS all open Postgres connections. Use `pg_ctl stop` (graceful) instead of `kill -9`. | |
| ⚠ If you can connect via `psql -h localhost` but not `psql -h 127.0.0.1`, your `pg_hba.conf` allows local socket but not TCP. Edit and reload. | |
| ⚠ Docker postgres + local postgres conflict: `docker run -p 5432:5432` fails if local postgres is already bound. Use `-p 5433:5432` and `psql -p 5433`. | |
Edge cases & caveats
Common use cases
- Verify Postgres install
- Diagnose 'connection refused' errors
- Multi-version Postgres setup
- Docker + native install conflicts
See what's bound to your local ports
portcheck shows pid, command, user, address — faster than netstat, simpler than ss. Linux + macOS, zero dependencies, MIT-licensed.
Open portcheck
Related
SSH · Node.js dev server (default) · Alternate HTTP / proxies / Tomcat · Cheatsheet of common dev ports · ↗ DB down → upstream timeout codes