UNIX
UNIX systems usage, administration and development information.

Guests are welcome to view our materials. To subscribe, edit, view raw markup, etc., you'll need to register for an account. Accounts are free (and will always be free) - your involvement helps us directly and indirectly (by demonstrating that our work matters to our funders...) StartingPoints has more info.
UNIX

PostgreSQL


main website: http://www.postgresql.org

documentation: http://www.postgresql.org/docs/


useful tasks

shutting down

[rob@localhost ~]$ su 
Password: 
[root@localhost rob]# su - postgres 
[postgres@localhost ~]$ /usr/local/pgsql/bin/pg_ctl stop -D /usr/local/pgsql/data -m smart 
waiting for server to shut down.... done server stopped 

user roles - creating, dropping, listing

  • users can only access the database if they have been explicitly added to postgres. User can only be added by other users who have this right.
  • v8.1.11 doc: http://www.postgresql.org/docs/8.1/static/user-manag.html
  • create - after installation, you can create new roles while being the postgres user (after installation only the postgres user can do this). A typical createuser session might look like this:
    [postgres@localhost ~]$ /usr/local/pgsql/bin/createuser rob 
    Shall the new role be a superuser? (y/n) n 
    Shall the new role be allowed to create databases? (y/n) y 
    Shall the new role be allowed to create more new roles? (y/n) y 
    CREATE ROLE 
    [postgres@localhost ~]$
  • drop - if you need to drop a user try this:
    /usr/local/pgsql/bin/dropuser username
  • list - To determine the set of existing roles, examine the pg_roles system catalog, for example
    SELECT rolname FROM pg_roles;


useful files

log file

/home/postgres/logfile


v 8.2.7

* uses roles now, so to start up if you haven't set your username as a "role" try sudo -u postgres /usr/local/pgsql/bin/psql test

-- RobertSajan - 29 Apr 2008

r3 - 30 Jul 2008 - 14:21:55 - HilaryHolz
Guests are welcome to view our materials. To subscribe, edit, view raw markup, etc., you'll need to register for an account. Accounts are free (and will always be free) - your involvement helps us directly and indirectly (by demonstrating that our work matters to our funders...) StartingPoints has more info.
This site is powered by the TWiki collaboration platformCopyright 1999-2009 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Ahatwiki? Send feedback Syndicate this site RSSATOM