How to use pg_dump / pg_dumpall with postgres DB?
I get, -bash: a.sql: Permission denied Same goes with pg_dump command.
This looks more like a file permission issue. Does the OS user have the right to write the dump file? Check file/directory permissions.
When you run the command
pg_dumpall > a.sql
then your shell will attempt to create the file a.sql
in the current directory. If you (as "user1") do not have permission to create files in the current directory, then first use the cd
command to change to a directory where you do have permission. You can use the pwd
command to see what the current directory actually is.