Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
postgresql [2008/07/14 16:13]
a
postgresql [2009/06/12 01:27]
a terminate a query which is taking a long time to run
Line 24: Line 24:
  
 You can also do this for a passwordless user: % crateuser bork You can also do this for a passwordless user: % crateuser bork
 +
 +**Creating a new user**
 +
 +   createuser -P <username>
 +
 +**creating a new database**
 +
 +   createdb -O <owner> <database_name>
 +
 +**changing postgsql user password** \\
 +
 +as postgres user (su - postgres) do:
 +<code>
 +$ psql template1
 +
 +   Welcome to psql 7.3.4, the PostgreSQL interactive terminal.
 +
 +   Type:  \copyright for distribution terms
 +          \h for help with SQL commands
 +          \? for help on internal slash commands
 +          \g or terminate with semicolon to execute query
 +          \q to quit
 +
 +template1=# ALTER USER <username> WITH ENCRYPTED PASSWORD '<newpassword>';
 +</code>
 +
 +**changeing ownership of database**
 +
 +   UPDATE pg_database SET datdba=(SELECT usesysid FROM pg_shadow WHERE usename='<username>') WHERE datname='<dbname>';
  
 **Inserting a time column** \\ **Inserting a time column** \\
Line 88: Line 117:
     order by whenx desc     order by whenx desc
  
 +**terminate a query which is taking a long time to run**
 +   SELECT procpid, current_query, query_start
 +   FROM pg_stat_activity;
 +   kill -INT procpid
  
  
postgresql.txt ยท Last modified: 2009/06/12 01:27 by a
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready