Postgresql dump permission denied

前端 未结 6 486
予麋鹿
予麋鹿 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:20

    backup and restore can be done by any unpriviledged user that knows the postgres superuser password by changing permissions on the working directory:

    % mkdir backup
    
    % chmod 0777 backup
    
    % su postgres
    
    [enter password]
    
    $ cd backup
    
    $ pg_dump mydb >tempfile
    
    $ exit
    

    "tempfile" will be owned by postgres and same group as the user

提交回复
热议问题