Create a user (role) or role(group) in Greenplum

Note:

1. Using create user or create role psql command

sachi=# \h create user

Command:     CREATE USER

Description: define a new database role

Syntax:

CREATE USER name [ [ WITH ] option [ ... ] ]

where option can be:

    

      SUPERUSER | NOSUPERUSER

    | CREATEDB | NOCREATEDB

    | CREATEROLE | NOCREATEROLE

    | CREATEUSER | NOCREATEUSER

    | INHERIT | NOINHERIT

    | LOGIN | NOLOGIN

    | CONNECTION LIMIT connlimit

    | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password'

    | VALID UNTIL 'timestamp' 

    | IN ROLE rolename [, ...]

    | IN GROUP rolename [, ...]

    | ROLE rolename [, ...]

    | ADMIN rolename [, ...]

    | USER rolename [, ...]

    | SYSID uid 

    | RESOURCE QUEUE queuename

sachi=# \h create role

Command:     CREATE ROLE

Description: define a new database role

Syntax:

CREATE ROLE name [[WITH] option [ ... ]]

where option can be:

      SUPERUSER | NOSUPERUSER

    | CREATEDB | NOCREATEDB

    | CREATEROLE | NOCREATEROLE

    | CREATEEXTTABLE | NOCREATEEXTTABLE 

      [ ( attribute='value'[, ...] ) ]

           where attributes and values are:

           type='readable'|'writable'

           protocol='gpfdist'|'http'|'gphdfs'

    | INHERIT | NOINHERIT

    | LOGIN | NOLOGIN

    | CONNECTION LIMIT connlimit

    | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password'

    | VALID UNTIL 'timestamp' 

    | IN ROLE rolename [, ...]

    | ROLE rolename [, ...]

    | ADMIN rolename [, ...]

    | RESOURCE QUEUE queue_name

sachi=# 

2. Createuser OS command/utilities

[gpadmin@localhost ~]$ createuser --help

createuser creates a new PostgreSQL role.

Usage:

createuser [OPTION]... [ROLENAME]

Options:

-c, --connection-limit=N connection limit for role (default: no limit)

-d, --createdb role can create new databases

-D, --no-createdb role cannot create databases

-e, --echo show the commands being sent to the server

-E, --encrypted encrypt stored password

-i, --inherit role inherits privileges of roles it is a

member of (default)

-I, --no-inherit role does not inherit privileges

-l, --login role can login (default)

-L, --no-login role cannot login

-N, --unencrypted do not encrypt stored password

-P, --pwprompt assign a password to new role

-r, --createrole role can create new roles

-R, --no-createrole role cannot create roles

-s, --superuser role will be superuser

-S, --no-superuser role will not be superuser

--help show this help, then exit

--version output version information, then exit

Connection options:

-h, --host=HOSTNAME database server host or socket directory

-p, --port=PORT database server port

-U, --username=USERNAME user name to connect as (not the one to create)

-w, --no-password never prompt for password

-W, --password force password prompt

If one of -d, -D, -r, -R, -s, -S, and ROLENAME is not specified, you will

be prompted interactively.

Report bugs to <pgsql-bugs@postgresql.org>.