Create User
Creates a new PostgreSQL database user.
Synopsis
CREATE USER username [ WITH [ SYSID uid ] [ PASSWORD 'password' ] ] [ CREATEDB | NOCREATEDB ] [ CREATEUSER | NOCREATEUSER ] [ IN GROUP groupname [, ...] ] [ VALID UNTIL 'abstime' ]
Parameters
usernameThe name of the new user you intend to create.
uidThe explicit user ID for the PostgreSQL user that you are creating; if left out of the
CREATE USERcommand, the user ID will be automatically assigned.passwordThe new PostgreSQL user’s password; if the database is setup to require password authentication, this must be set for the user to be able to connect. Otherwise, a defined password is not meaningful to PostgreSQL.
CREATEDB | NOCREATEDBThe privilege to create new databases. Use
CREATEDB, to give the user permission to create databases. UseNOCREATEDBto explicitly deny that permission (which is the default).CREATEUSER | NOCREATEUSERThe superuser privilege. The use of
CREATEUSERallows access to both theCREATE USERandDROP USERcommands, as well as makes the user a superuser (with universal rights across all databases).NOCREATEUSERis the default.groupnameThe optional name of a group to which the user is to automatically be added.
abstimeThe timestamp that defines when a user’s password expires. When the date and time that
abstimedefines has been reached, the user’s defined password becomes invalid. If unset, the password never expires.
Results
CREATE USERThe message returned when a user is created successfully.
Description
Use ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access