postgresql 如何将 pg_dump 与连接 uri / url 一起使用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29039437/
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
How to use pg_dump with a connection uri / url?
提问by Tronathan
I can invoke psql
like this:
我可以这样调用psql
:
psql postgres://...
How can I use pg_dump
with a connection string in the format postgres://...
?
Would be more convenient than breaking URI's into host, post, username, password.
如何使用pg_dump
格式的连接字符串postgres://...
?
比将 URI 分成主机、帖子、用户名、密码更方便。
Is there syntax for this?
有没有这方面的语法?
回答by Jorge Diaz
Apparently it's as simple as this:
显然就这么简单:
pg_dump postgres://username:[email protected]:5432/databasename
I just downloaded a dump using this format.
Optionally you can add -f filename
to specify a local filename.
我刚刚使用这种格式下载了转储。您可以选择添加-f filename
以指定本地文件名。