Port 5432: PostgreSQL

Port 5432 (TCP) is used by PostgreSQL. Default PostgreSQL server port.

5432Port
TCPProtocol
postgresqlIANA service name
DatabasesCategory

Port range

5432 is a registered port (range 1024–49151). Any user can bind to it; IANA records which service registered the number.

Security

Port 5432 should not be reachable from the public internet. Restrict it to trusted networks or a VPN, and scan your public IP to confirm it is closed.

Open port 5432 in a firewall

ufw         sudo ufw allow 5432/tcp
iptables    sudo iptables -A INPUT -p tcp --dport 5432 -j ACCEPT
firewalld   sudo firewall-cmd --permanent --add-port=5432/tcp
Windows     New-NetFirewallRule -DisplayName "PostgreSQL 5432" -Direction Inbound -Protocol TCP -LocalPort 5432 -Action Allow

Check if port 5432 is open

nc -vz example.com 5432
Test-NetConnection example.com -Port 5432   # PowerShell
sudo ss -tulpn | grep ':5432 '   # what is listening locally (Linux)

Other databases ports

Frequently asked questions

What is port 5432 used for?
PostgreSQL. Default PostgreSQL server port.
Is port 5432 TCP or UDP?
TCP.