Postgresql dump permission denied

前端 未结 6 484
予麋鹿
予麋鹿 2021-02-03 18:52

I get this error while trying to dump database, i entered

linuxuser $ sudo su postgres
linuxuser $ [sudo] password for linuxuser:...
$ pg_dump -h localhost mydb          


        
6条回答
  •  情歌与酒
    2021-02-03 19:28

    I wrestled with this "Permission Denied" issue while trying to backup my PSQL database on an Ubuntu machine for a long time, and tried user access rights, superuser status, folder properties--lots of stuff. Finally, something worked that was ridiculously simple. In the command:

    pg_dump -U username -O dbname > 'filename.sql'
    

    Make sure you have quotes (single or double quotes seem to work) around the filename which follows the greater than (">") sign. The examples above do not have quotes around the filename. Once I tried that, I no longer received Permission Denied errors.

提交回复
热议问题