It seems I installed PostgreSQL 9.5.5 correctly. and Psycopg2 on Ubuntu 16.04, and you can log in via:
sudo -u postgres psql
If I issue \conninfo, I get the following:
You are connected to database "postgres" as user "postgres" via socket in "/var/run/postgresql" at port "5432".
Of course, I would have to connect via psycopg2 in the same way as shown here , but the script:
import psycopg2
conn = psycopg2.connect("dbname=postgres user=postgres")
conn.close()
gives me:
psycopg2.OperationalError: FATAL: Peer authentication failed for user "postgres"
I only need PostgreSQL for personal use, so I do not want to enable TCP authentication.
How to use peer-to-peer authentication with the "postgress" user in Psycopg2?
source
share