What port does PostgreSQL use?
PostgreSQL uses port 5432 over TCP.
| Port | Protocol | Name | What it is for |
|---|---|---|---|
| 5432 | TCP | PostgreSQL | The default PostgreSQL port. |
What catches people out
Keep it on a private network. Configure `pg_hba.conf` deliberately — a permissive `host all all 0.0.0.0/0 md5` line is a common and serious mistake.
Checking it is listening
sudo lsof -i :5432 # macOS, Linux
netstat -ano | findstr :5432 # Windows
nc -zv host 5432 # from elsewhere
An "address already in use" error on a port nothing appears to be holding usually means the socket is in TIME_WAIT rather than that a process has it — the ports reference covers that and the ephemeral range.
Frequently asked questions
What port does PostgreSQL use?
PostgreSQL uses port 5432 over TCP. The default PostgreSQL port.
What should I watch out for with port 5432?
Keep it on a private network. Configure `pg_hba.conf` deliberately — a permissive `host all all 0.0.0.0/0 md5` line is a common and serious mistake.
How do I check whether PostgreSQL is listening?
sudo lsof -i :5432 on macOS or Linux, netstat -ano | findstr :5432 on Windows. From another machine, nc -zv host 5432 says whether anything answers.
Other services
- What port does SQL Server use?
- What port does Oracle use?
- What port does MongoDB use?
- What port does Redis use?
- What port does Memcached use?
- What port does Elasticsearch use?
- What port does DNS use?
- What port does NTP use?
- What port does SMB use?
- What port does NFS use?
- What port does SNMP use?
- What port does Syslog use?