pg_dumpall -U postgres -h localhost -f pg12bak.sql NB: you will be prompted to enter your password severally and to avoid that: https://stackoverflow.com/questions/50404041/pg-dumpall-without-prompting-password