Re: running postgres - Mailing list pgsql-general

From Sam Mason
Subject Re: running postgres
Date
Msg-id 20090205121633.GC3008@frubble.xen.chris-lamb.co.uk
Whole thread Raw
In response to running postgres  (Kusuma Pabba <kusumap@ncoretech.com>)
List pgsql-general
On Thu, Feb 05, 2009 at 12:05:31PM +0530, Kusuma Pabba wrote:
> how can i create a user  in test or template
> when i give create user
> it is asking for create role , how should i create role?

Users are associated with the "cluster" and not with any specific
database.  I tend to add users by directly entering the SQL, but, as
others have noted, there's a program called "createuser" that you can
use instead.  Only a few users can normally create new users (or "roles"
as they have recently been changed to) and you can see who by typing
\du into psql and looking for the "Create role" column.  Normally only
the database owner (i.e. the "postgres" user) can create new users by
default, which is probably where you got the "su postgres" command from.

Once you've logged in with somebody whose capable of creating users, you
need to type something like:

  CREATE USER furble;
  GRANT CONNECT ON DATABASE test TO furble;

This will create the user "furble" and allow them to connect to the
"test" database.  I believe it's generally preferable to use groups to
control permission and add users to groups rather than granting them
specific rights.  But use cases vary.  The manual pages for these things
are:

  http://www.postgresql.org/docs/current/static/user-manag.html
  http://www.postgresql.org/docs/current/static/sql-createrole.html
  http://www.postgresql.org/docs/current/static/sql-grant.html
  http://www.postgresql.org/docs/current/static/app-createuser.html

You will probably need to think about authentication, at which point the
following section will help:

  http://www.postgresql.org/docs/current/static/client-authentication.html

--
  Sam  http://samason.me.uk/

pgsql-general by date:

Previous
From: Harald Fuchs
Date:
Subject: Re: Array, bytea and large objects
Next
From: Filip Rembiałkowski
Date:
Subject: Re: Array, bytea and large objects