5432 TCP
Relational SQL Database IANA Registered (PostgreSQL Database)

Port 5432 — PostgreSQL Relational Database

The official standard TCP listening port for the PostgreSQL relational database server, pgvector extensions, and Supabase local development containers.

Default Protocol TCP / IP
Typical Localhost URL postgres://localhost:5432
Default Process postgres.exe
Primary Framework PostgreSQL

1. What is Port 5432?

Port 5432 is the officially assigned IANA port for PostgreSQL, the world's most advanced open-source object-relational database management system. All PostgreSQL client libraries (pg in Node.js, asyncpg in Python, Npgsql in .NET, JDBC in Java) target port 5432 by default.

Port 5432 was registered with IANA in the 1990s by the PostgreSQL Global Development Group. It is within the user/registered port range (1024–49151).

2. How Port 5432 Works Under the Hood

1
Socket Creation & Binding

Process creates a Winsock socket (`AF_INET`/`AF_INET6`, `SOCK_STREAM`) and binds to local port 5432.

2
Kernel TCP Listener Table

Windows TCP/IP stack records the listening state in `MIB_TCPTABLE_OWNER_PID`.

3
Request Handling & Loopback Dispatch

Inbound HTTP/TCP traffic to `127.0.0.1:5432` is delivered directly through Windows loopback with zero physical NIC overhead.

The PostgreSQL engine (`postgres.exe`) starts a postmaster process that listens on TCP port 5432. 1. When a backend client initiates a connection, postmaster performs authentication (MD5/SCRAM-SHA-256) over TCP. 2. Once authenticated, postmaster forks or spawns a dedicated backend worker thread to handle all SQL queries over a binary stream protocol. 3. Connection poolers like PgBouncer often sit on 6432 or 5432 to multiplex thousands of client connections onto a small pool of database workers.

3. Common Conflicts & 'FATAL: lock file 'postmaster.pid' already exists / Error: bind: address already in use (5432)'

⚠️ Common Error Message
FATAL: lock file 'postmaster.pid' already exists / Error: bind: address already in use (5432)

The most notorious conflict on Windows happens when you install PostgreSQL directly via the Windows `.exe` installer (which installs a background Windows Service running 24/7) and later try to run a Docker Compose stack: ```text docker: Error response from daemon: driver failed programming external connectivity on endpoint my-postgres: Bind for 0.0.0.0:5432 failed: port is already allocated. ``` Stopping the background Windows service via `net stop postgresql-x64-16` or using PortPeek to inspect the process allows your container stack to start immediately.

💡 Pro Tip: A native Windows PostgreSQL service running in background frequently clashes with Docker containers attempting to bind `-p 5432:5432`.

4. How to Find & Stop the Process on Port 5432

If port 5432 is locked by an orphaned process or background service, choose one of the following methods:

Terminal Commands (Manual) PortPeek (1-Click Instant)

PowerShell (Recommended):

Get-Process -Id (Get-NetTCPConnection -LocalPort 5432).OwningProcess | Stop-Process -Force

Classic CMD (Command Prompt):

for /f "tokens=5" %a in ('netstat -aon ^| findstr :5432') do taskkill /f /pid %a
PortPeek

Or simply use PortPeek

Never memorize netstat flags or parse PIDs again.

1. Press Win + Alt + P anywhere on Windows.
2. See Port 5432 with its owning process (postgres.exe) and memory usage.
3. Click Stop Process to kill it instantly, or click the item to launch in your browser.
Download PortPeek (Free & Open Source)

5. Standards & Related Ports

Official Specifications:

  • IANA Service Name and Transport Protocol Port Number Registry
  • RFC 6335, PostgreSQL Frontend/Backend Protocol 3.0
  • Windows Sockets 2 (Winsock) API Documentation