-
Notifications
You must be signed in to change notification settings - Fork 1
Default PostgreSQL connection configurations
Leopold Talirz edited this page Apr 5, 2020
·
2 revisions
A list of the default connection configurations of PostgreSQL in the pg_hba.conf
installed by different means.
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Database administrative login by Unix domain socket
local all postgres peer
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Database administrative login by Unix domain socket
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
- On MacOS (
macports
,brew
), CentOS (yum
) or anyconda
installation, no password is needed for any local connection andpsycopg2
will work out of the box, both over local sockets and TCP/IP. - On Ubuntu with Postgresql installed via
apt
, passwordless login is possible only for postgres users with the same name as the UNIX user. E.g. if you are theubuntu
user, you cannot use a local connection to connect to the server as thepostgres
user - you first need to becomepostgres
. Furthermore, after you've becomepostgres
and created a new database, database user and password, you cannot use local connections to connect as your new database user via sockets. You must use TCP/IP (-h localhost
).