pg_dump -U myapp_user myapp_db > backup.sql

Category: Self-Hosting

pg_dump -U myapp_user myapp_db > backup.sql

Export a PostgreSQL database to a SQL file — the standard backup method

Exports a PostgreSQL database to a plain-text SQL file. Can be restored on any PostgreSQL instance and is human-readable.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.