如何在 MAC OSX 而非 Windows 上的 Postgres Sql 9.6 中备份和恢复

How to backup and restore in Postgres Sql 9.6 on MAC OSX not in Windows

我是 Mac 世界的新手,试图在 postgres sql 上进行备份和恢复。我已经在 mac machine 上安装了 postgresql。我试图创建一个文件 .bash_profile 并给出了 postgres 的路径“/Library/PostgreSQL/9.6/bin” 下面是我正在尝试 运行 在终端

中的命令
/Library/PostgreSQL/9.6/bin/pg_restore --host "localhost" --port "5432" --username "postgres" --dbname "postgres" /Library/PostgreSQL/9.6/bin/my.backup

但不知何故无法正常工作。使用 PG admin 4 恢复现有 table 时,我的权限被拒绝

[Errno 13] Permission denied: u'/Library/PostgreSQL/9.6/bin/aa.backup'

我猜你使用的用户帐户不是备份文件的所有者尝试像这样更改为 postgres 用户

$ su postgres

然后执行备份命令。 但首先您应该更改备份文件的所有者。使用:

 chown postgres /Library/PostgreSQL/9.6/bin/aa.backup