postgres

From thelinuxwiki
Jump to: navigation, search

controlling access/authentication

file: pg_hba.conf path: /etc/postgresql/<version>/main/

example of no auth from local any user

add line...

local all all trust

restart server?

basic commands via CLI

connect as user postgres

psql -U postgres
postgres-#

list all databases

postgres-# \l
                                   List of databases
  Name    |    Owner    | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+-------------+----------+-------------+-------------+-----------------------
 postgres  | postgres    | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
template0 | postgres    | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
          |             |          |             |             | postgres=CTc/postgres
template1 | postgres    | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
          |             |          |             |             | postgres=CTc/postgres

quit

\q