ssh -L 5432:localhost:5432 user@203.0.113.10

Category: VPS Management

ssh -L 5432:localhost:5432 user@203.0.113.10

Forward the remote server's PostgreSQL port to your local machine

SSH local port forwarding — creates a tunnel so you can connect to the VPS's database from your local machine as if it were running locally. Connect your DB client to localhost:5432 while this tunnel is open.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.