如何在 Linux 上运行 Pg_dump/pg_dumpall 命令?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11047185/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 06:52:20  来源:igfitidea点击:

How to run Pg_dump/pg_dumpall command on Linux?

linuxpostgresql

提问by Vivek Kumar Ray

Hello everyone i am try to create backup in postgres through dump. when i run the command through command line it wants password when i give the password it will give some error

大家好,我正在尝试通过转储在 postgres 中创建备份。当我通过命令行运行命令时它需要密码当我提供密码时它会给出一些错误

pg_dump: [archiver (db)] connection to database "nsdgpkidb" failed: FATAL: password authentication failed for user "root"

pg_dump: [archiver (db)] 到数据库“nsdgpkidb”的连接失败:致命:用户“root”的密码验证失败

if any one have some valuable time please help me thanks.

如果有人有一些宝贵的时间请帮助我谢谢。

采纳答案by Artem Koshelev

Such kind of questions are better to ask on ServerFault. You have to provide pg_dump with the valid postgresql account via command line parameter:

这类问题最好在ServerFault 上提出。您必须通过命令行参数为 pg_dump 提供有效的 postgresql 帐户:

pg_dump -U postgres nsdgpkidb > file.sql

By default it assumes the current local user account (root). Another way is to change the current userand issue the command.

默认情况下,它采用当前的本地用户帐户 (root)。另一种方法是更改当前用户并发出命令。