Skip to content

Instantly share code, notes, and snippets.

@arthur-e
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arthur-e/9021140 to your computer and use it in GitHub Desktop.
Save arthur-e/9021140 to your computer and use it in GitHub Desktop.

Managing the PostgreSQL Service

The service name is postgresql and it accepts the usual commands for a background service:

  • start
  • stop
  • restart
  • status
$ sudo service postgresql restart

Configuring Database Access

After installation, the contents of pg_hba.conf default to the following.

# 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
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                               peer
#host    replication     postgres        127.0.0.1/32           md5
#host    replication     postgres        ::1/128                md5

To enable authenticated users to log-in through Unix domain socket connections (e.g. connecting to the database with database middleware such as Django), change the second configuration to the following line.

# Enable authenticated users to log-in with MD5 passwords on Unix domain socket connections
local   all             all                                     md5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment