Difference between revisions of "postgres"

From thelinuxwiki
Jump to: navigation, search
(Created page with "==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 resta...")
 

Latest revision as of 16:57, 16 November 2021

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