pg_dump:命令行参数太多(第一个是“--host=localhost”)

Chi*_*fir 2 python django postgresql database-backups

我已经解决了一些类似的问题,但没有找到任何可行的解决方案。

我尝试djang-dbbackup在我的 Django 项目中使用模块。我运行$ python manage.py dbbackup并收到此错误:

CommandConnectorError: Error running:  pg_dump last_cosmetics --host=localhost --username=postgres --no-password --clean 
b'pg_dump: too many command-line arguments (first is "--host=localhost")\r\nTry "pg_dump --help" for more information.\r\n'
Run Code Online (Sandbox Code Playgroud)

我还尝试在 Windows cmd 上运行它。

pg_dump last_cosmetics --host=localhost --username=postgres --no-password --clean
Run Code Online (Sandbox Code Playgroud)

但我仍然遇到同样的错误。

小智 5

您可以在此处检查语法。

数据库名称应该是所有选项之后的最后一个参数。

所以在你的情况下使用:

pg_dump --host=localhost --username=postgres --no-password --clean last_cosmetics
Run Code Online (Sandbox Code Playgroud)