我想让我的Django站点的数据库转储,但Django的本地dumpdata命令对于大型数据库来说相当糟糕,所以我想使用pg_dump。为什么可以psycopg2连接到我的数据库,我不能
这工作:
python
>>> import psycopg2
>>> psycopg2.connect(database='blah',user='blah',password='blah',host='localhost')
这不起作用
bash
# psql -U blah blah
psql: FATAL: Ident authentication failed for user "blah"
# pg_dump -U blah blah
pg_dump: [archiver (db)] connection to database "blah" failed: FATAL: Ident authentication failed for user "blah"
我搜索的提示,也许我需要/etc/postgresql/9.0/main/pg_hba.conf
改变 “标识” 为 “密码”。这是一个合理的改变?为什么我无法使用任何方法对python psycopg2正常工作进入pg_dump?
您是否尝试指定与代码中相同的选项?即'psql -h localhost -u blah -W' – nos