postgresql pg_dump windows 命令提示无效命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45375689/
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 windows command prompt invalid command
提问by ziggy
trying to using pg_dump to backup a postgres db
尝试使用 pg_dump 备份 postgres 数据库
i connected through the command prompt and here is my command following this tutorial http://www.postgresqltutorial.com/postgresql-backup-database/
我通过命令提示符连接,这是我按照本教程的命令http://www.postgresqltutorial.com/postgresql-backup-database/
pg_dump -U postgres -W -F t lucz_2017 > X:\postgres_backup\lucz_backup.tar
it gives me an error
它给了我一个错误
Invalid command \postgres_backup. Try \? for help.
what am I doing wrong?
我究竟做错了什么?
the db name and paths are correct
数据库名称和路径是正确的
windows 7 running this from the CMD
Windows 7 从 CMD 运行它
采纳答案by Julia Leder
You are running pg_dump from psql. Get out of psql and run pg_dump command from Windows Command prompt. pg_dump is its own executable, different from psql.
您正在从 psql 运行 pg_dump。退出 psql 并从 Windows 命令提示符运行 pg_dump 命令。pg_dump 是它自己的可执行文件,不同于 psql。
回答by Spider
This works for me in Windows PowerShell in Windows 10:
这在 Windows 10 中的 Windows PowerShell 中对我有用:
.\pg_dump.exe --username "yourUserName" --no-owner "yourDatabasName" >./filename.sql