Port 5432 is the default PostgreSQL database port. Like MySQL, PostgreSQL should not be exposed to the public internet. PostgreSQL supports SSL natively – connections can be encrypted without SSH tunneling. pg_hba.conf controls which hosts can connect and what authentication methods are required.
Port Number
5432
Protocol
TCP
Service
PostgreSQL Database
Range
IANA Registered (1024–49151)
Test connectivity and show PostgreSQL version
psql -h host -p 5432 -U postgres -c 'SELECT version();'Check if PostgreSQL is accepting connections (no auth needed)
pg_isready -h host -p 5432Show which process listens on 5432 and bound address
ss -tnlp sport = :5432Audit pg_hba.conf rules directly from SQL (PostgreSQL 10+)
psql -c "SELECT * FROM pg_hba_file_rules;"psql -h localhost -p 5432 -U postgres
psql 'postgresql://user:pass@localhost:5432/db'
pg_dump -h localhost -p 5432 dbnamePostgreSQL originated as POSTGRES at UC Berkeley in 1986, becoming PostgreSQL in 1996 when SQL support was added. Port 5432 was registered with IANA. The project has released annual major versions since 2017, with each version supported for 5 years.
How do I enable SSL for PostgreSQL connections?
In postgresql.conf: ssl = on, ssl_cert_file = '/path/server.crt', ssl_key_file = '/path/server.key'. In pg_hba.conf: use 'hostssl' instead of 'host' to require SSL. Test with: psql 'sslmode=require host=server dbname=db'.
PgBouncer vs direct PostgreSQL connection?
PgBouncer (port 6432) pools connections – 1000 application connections share 20 actual PostgreSQL connections. Essential for serverless/lambda workloads that create many short-lived connections. PostgreSQL forks a process per connection (~10MB each), so direct connections do not scale past ~500 concurrent.