【问题标题】:I am unable to restore a pg_dump backup我无法恢复 pg_dump 备份
【发布时间】:2019-12-05 07:21:02
【问题描述】:

在我即将死去的 Ubuntu 18.04 系统上,我能够检索到 crewdb_bak.tar file(PostgreSQL 备份文件)并将其保存到 USB。该文件是使用以下命令创建的:

pg_dump -U postgres -h localhost -W -F t crowddb > /home/chris1/Documents/crewcut/crewdb/crewdb_bak.tar

在安装 PostgreSQL 后的新 Ubuntu 系统上,我在终端中运行以下命令来恢复数据库:

psql -U postgres -d crowddb /chh1/1818-305D/crewdb_bak.tar

不幸的是,我得到以下输出:

psql: FATAL: Peer authentication failed for user "postgres"

pg_dump -U postgres -h localhost -W -F t crowddb > /home/chris1/Documents/crewcut/crewdb/crewdb_bak.tar

psql -U postgres -d crowddb /chh1/1818-305D/crewdb_bak.tar

【问题讨论】:

    标签: postgresql pg-dump


    【解决方案1】:

    您可能会发现这个其他问题很有帮助:Getting error: Peer authentication failed for user "postgres", when trying to get pgsql working with rails

    特别是,接受的答案建议编辑您的pg_hba.conf 文件并检查postgres 用户的设置。您看到的错误表明它设置为对等。

    您可以查看authentication documentation for postgres,它可以帮助您确定最适合您使用的类型。

    如果你仍然可以访问垂死的系统,也许看看它设置了什么?

    【讨论】:

    • 感谢尼克的回答。我根据您的建议编辑了 pg_hba.conf 文件,并且能够通过错误消息。我现在的问题是数据库结构(表和视图)已正确恢复,但是表中没有数据。有什么想法吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多