跳至內容
選單
此問題已被標幟
1 回覆
6827 瀏覽次數

I have created that script to connect with the odoo database using erp peek  i want to dump that database to my local machine .. the script is below

import os

import time

import subprocess

import erppeek

SERVER = 'http://localhost:8069'

client = erppeek.Client(server=SERVER)

print "connection success"

dump_dir = '/var/lib/postgresql/9.3/main'

db_username = ['admin']

db_names = ['ErpPeekDemoDatabase']

for db_name in db_names:

try:

dumper = " -U %s --password -Z 9 -f %s -F c %s "

bkp_file = '%s_%s.sql' % (db_name, time.strftime('%Y%m%d_%H_%M_%S'))

file_path = os.path.join(dump_dir, bkp_file)

command = 'pg_dump' + dumper % (db_username, file_path, db_name)

subprocess.call(command, shell=True)

subprocess.call('gzip ' + file_path, shell=True)

print "backup success"

except:

print "Couldn't backup database" % (db_name)


 i got this error

pg_dump: [archiver (db)] connection to database "ErpPeekDemoDatabase" failed: FATAL: Peer authentication failed for user "[admin]"

backup success

頭像
捨棄
最佳答案

Check your pg_hba.conf configuration and set necessary permission

# "local" is for Unix domain socket connections only

local all all peer

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
3月 15
5948
4
4月 24
1849
3
5月 22
15444
1
12月 16
3187
1
3月 15
12172