#python2.6
>import psycopg2
>psycopg2.connect(database="prac2", user="postgres", password="password", host="localhost")
Maybe the server is down, you have a firewall issue or your
pg_hba.conf is not open for localhost connections:
host all all 127.0.0.1 md5
hostssl all all 127.0.0.1 md5
(use 127.0.0.1 as ipv6 localhost address may conflict)
Best regards,
Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com
Put * or 127.0.0.1 or the ip addresses you want to open.
Then, restart the server and test with psql command line tool:
psql prac2 -U lucas -h 127.0.0.1
It should ask you the password and let you in, if not, you still have
a problem with the pg_hba.conf.
This is a example that might work:
local all postgres ident
local all all ident
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
host all all 0.0.0.0/0 md5
hostssl all all 0.0.0.0/0 md5
Remove any line with "ident" method and "host" access type.
Warning: the last two lines open postgresql for all ip addresses (with
password auth)
Best regards,
Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com
RuntimeError: Failure to connect, tried 5 times: