Search Postgresql Archives

Re: running postgres

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux