PostgreSQL

Show databases

$ psql -l
or
$ psql MyDB
MyDB-# \l

                         List of databases
   Name    | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-------+----------+---------+-------+-------------------
 openerp   | pgsql | UTF8     | C       | C     |
 postgres  | pgsql | UTF8     | C       | C     |
 template0 | pgsql | UTF8     | C       | C     | =c/pgsql         +
           |       |          |         |       | pgsql=CTc/pgsql
 template1 | pgsql | UTF8     | C       | C     | =c/pgsql         +
           |       |          |         |       | pgsql=CTc/pgsql
(4 rows)

Show roles/user

MyDB-# \du
                             List of roles
 Role name |                   Attributes                   | Member of
-----------+------------------------------------------------+-----------
 openerp   |                                                | {}
 pgsql     | Superuser, Create role, Create DB, Replication | {}

Change role/user

MyDB-# alter role openerp CREATEDB;
ALTER ROLE

Leave a Reply

Your email address will not be published. Required fields are marked *