Creates a new database role.
createuser [<connection-option> ...] [<role_attribute> ...] [-e] <role_name>
createuser -? | --help
createuser -V | --version
createuser
creates a new Greenplum Database role. You must be a superuser or have the CREATEROLE
privilege to create new roles. You must connect to the database as a superuser to create new superusers.
Superusers can bypass all access permission checks within the database, so superuser privileges should not be granted lightly.
createuser
is a wrapper around the SQL command CREATE ROLE
.
createuser
generates and sends to the server.
-d
/
-D
,
-r
/
-R
,
-s
/
-S
is not specified on the command line.
createuser
will issue a prompt for the password of the new role. This is not necessary if you do not plan on using password authentication.
CREATEROLE
privilege).
createuser
version and exit.
REPLICATION
privilege, which is described more fully in the documentation for
CREATE ROLE.
REPLICATION
privilege, which is described more fully in the documentation for
CREATE ROLE.
createuser
command line arguments, and exit.
Connection Options
PGHOST
or defaults to localhost.
PGPORT
or defaults to 5432.
PGUSER
or defaults to the current system role name.
.pgpass
file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.
To create a role joe
on the default database server:
$ createuser joe
To create a role joe
on the default database server with prompting for some additional attributes:
$ createuser --interactive joe
Shall the new role be a superuser? (y/n) **n**
Shall the new role be allowed to create databases? (y/n) **n**
Shall the new role be allowed to create more new roles? (y/n) **n**
CREATE ROLE
To create the same role joe
using connection options, with attributes explicitly specified, and taking a look at the underlying command:
createuser -h coordinatorhost -p 54321 -S -D -R -e joe
CREATE ROLE joe NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT
LOGIN;
CREATE ROLE
To create the role joe
as a superuser, and assign password admin123
immediately:
createuser -P -s -e joe
Enter password for new role: admin123
Enter it again: admin123
CREATE ROLE joe PASSWORD 'admin123' SUPERUSER CREATEDB
CREATEROLE INHERIT LOGIN;
CREATE ROLE
In the above example, the new password is not actually echoed when typed, but we show what was typed for clarity. However the password will appear in the echoed command, as illustrated if the -e
option is used.