postgresql pg_dump 失败并出现错误:`致命:角色“用户名”不存在`
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37672262/
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
pg_dump fails with error: `FATAL: role "username" does not exist`
提问by Suraj
I have a db named backupdb
, I want to import this to my local rails app so I want to take a dump of it.
我有一个名为 的数据库backupdb
,我想将它导入到我的本地 Rails 应用程序中,所以我想转储它。
When I am running pg_dump backupdb
, I am getting below error.
当我运行pg_dump backupdb
时,出现以下错误。
pg_dump: [archiver (db)] connection to database "backupdb" failed: FATAL: role "username" does not exist
pg_dump: [archiver (db)] 连接到数据库“backupdb”失败:致命:角色“用户名”不存在
what's wrong here. Please help.
这里有什么问题。请帮忙。
I downloaded the db from my email and then trying to create a dump so I can import it to my local rails app
我从我的电子邮件中下载了数据库,然后尝试创建一个转储,以便我可以将它导入到我的本地 Rails 应用程序中
回答by CodeMaker
try this may be it work for you
试试这可能对你有用
$ pg_dump -h localhost -U postgres -Fc mydb > db.dump
回答by xyious
You're giving "username" as username
, which does not exist. You need to pass a username that exists (postgres would probably do).
add parameters --username=postgres --password
and it will ask you for the password for user postgres. (you might have security set to trust in your pg_hba.conf in which case leaving out --password would work.
您将“用户名”作为username
,但不存在。您需要传递一个存在的用户名(postgres 可能会这样做)。
添加参数--username=postgres --password
,它会要求您输入用户 postgres 的密码。(您可能将安全设置为信任您的 pg_hba.conf,在这种情况下,省略 --password 会起作用。
回答by Mani Deep
回答by SupaMario
If someone has the same problem using intellij, here is what helped me: In my case the Problem was, that i right clicked the datasource, but you have to open it and right click the database itself. So in the image below don't click on localDB. Right click the database name and then do a dump.
如果有人使用 intellij 遇到同样的问题,这对我有帮助:就我而言,问题是,我右键单击了数据源,但您必须打开它并右键单击数据库本身。所以在下图中不要点击localDB。右键单击数据库名称,然后进行转储。
Hope this will help someone to solve this confusing UX problem. :D
希望这能帮助某人解决这个令人困惑的用户体验问题。:D