Can I use md5 authentication with psycopg2?

After two hours of reading the documentation, source code and reference threads, I refuse. I cannot force psycopg2 to authenticate using the md5 line. According to this thread, I don't need anything other than turning on md5-auth in pg_hba.conf.

This is my current one pg_hba.conf:

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
local   all         all                               md5
host    all         all         127.0.0.1/32          md5
host    all         all         ::1/128               md5
host    all         all         0.0.0.0/0             md5

And I use psycopg2 as follows:

psycopg2.connect(host='localhost', port=5433, user='me', password='md5xxxx').cursor()

What gives:

psycopg2.OperationalError: FATAL:  password authentication failed for user "me"

Naturally, this password is the same as pg_authid.rolpassword.

According to it pg_hba.conf, I can only log in using md5-auth (right?). However, my unmanaged password works fine (and there is no hashing), and I cannot find links to psycopg2 by hashing it in my source code.

reference

Thank!

+5
1

Psycopg2 - libpq, Postgres, . . ( libpq) .


, libpq MD5 , , MD5 MD5, (. ). .

+5

All Articles