PostgreSQL 18 · Backup and restore

Back up as plain SQL

Write a SQL script you can read and replay with psql.

pg_dump -U postgres -d mydb -f mydb.sql

Official PostgreSQL 18 documentation

More backup and restore commands

All backup and restore commands · PostgreSQL 18 cheatsheet

Was this page helpful?