{"Entry":{"collection":"tool","key":"createuser","name":"createuser","aliases":["createuser"],"metadata":{"aliases":["createuser"],"category":"Client applications","content_hash":"11e7d2afacaae9254332a7d6627ef025edce40af6ad13e32e7e043e77a553924","derived_content_hash":"d3039a3baa39a097badf2c9f976534e66ffd996fca68e9f8882c4cd7a566a6f4","imported_at":"2026-09-30T00:40:33.875523+08:00","name":"createuser","name_zh":"","slug":"createuser","summary":"createuser — define a new PostgreSQL user account"}},"Definition":{"Collection":"tool","Key":"createuser","SourceDatabase":"center","Version":"18","SourceTable":"command_tool","SourceKey":"createuser","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","Facts":{"comparison_data":{"environment":[{"description":"Default connection parameters","name":"PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"options":[{"description":"Specifies an existing role that will be automatically added as a member of the new role with admin option, giving it the right to grant membership in the new role to others. Multiple existing roles can be specified by writing multiple -a switches.","names":["-a role","--with-admin= role"],"signature":"-a role --with-admin= role"},{"description":"Set a maximum number of connections for the new user. The default is to set no limit.","names":["-c number","--connection-limit= number"],"signature":"-c number --connection-limit= number"},{"description":"The new user will be allowed to create databases.","names":["-d","--createdb"],"signature":"-d --createdb"},{"description":"The new user will not be allowed to create databases. This is the default.","names":["-D","--no-createdb"],"signature":"-D --no-createdb"},{"description":"Echo the commands that createuser generates and sends to the server.","names":["-e","--echo"],"signature":"-e --echo"},{"description":"This option is obsolete but still accepted for backward compatibility.","names":["-E","--encrypted"],"signature":"-E --encrypted"},{"description":"Specifies the new role should be automatically added as a member of the specified existing role. Multiple existing roles can be specified by writing multiple -g switches.","names":["-g role","--member-of= role","--role= role"],"signature":"-g role --member-of= role --role= role (deprecated)"},{"description":"The new role will automatically inherit privileges of roles it is a member of. This is the default.","names":["-i","--inherit"],"signature":"-i --inherit"},{"description":"The new role will not automatically inherit privileges of roles it is a member of.","names":["-I","--no-inherit"],"signature":"-I --no-inherit"},{"description":"Prompt for the user name if none is specified on the command line, and also prompt for whichever of the options -d / -D , -r / -R , -s / -S is not specified on the command line. (This was the default behavior up to PostgreSQL 9.1.)","names":["--interactive"],"signature":"--interactive"},{"description":"The new user will be allowed to log in (that is, the user name can be used as the initial session user identifier). This is the default.","names":["-l","--login"],"signature":"-l --login"},{"description":"The new user will not be allowed to log in. (A role without login privilege is still useful as a means of managing database permissions.)","names":["-L","--no-login"],"signature":"-L --no-login"},{"description":"Specifies an existing role that will be automatically added as a member of the new role. Multiple existing roles can be specified by writing multiple -m switches.","names":["-m role","--with-member= role"],"signature":"-m role --with-member= role"},{"description":"If given, createuser will issue a prompt for the password of the new user. This is not necessary if you do not plan on using password authentication.","names":["-P","--pwprompt"],"signature":"-P --pwprompt"},{"description":"The new user will be allowed to create, alter, drop, comment on, change the security label for other roles; that is, this user will have CREATEROLE privilege. See role creation for more details about what capabilities are conferred by this privilege.","names":["-r","--createrole"],"signature":"-r --createrole"},{"description":"The new user will not be allowed to create new roles. This is the default.","names":["-R","--no-createrole"],"signature":"-R --no-createrole"},{"description":"The new user will be a superuser.","names":["-s","--superuser"],"signature":"-s --superuser"},{"description":"The new user will not be a superuser. This is the default.","names":["-S","--no-superuser"],"signature":"-S --no-superuser"},{"description":"Set a date and time after which the role's password is no longer valid. The default is to set no password expiry date.","names":["-v timestamp","--valid-until= timestamp"],"signature":"-v timestamp --valid-until= timestamp"},{"description":"Print the createuser version and exit.","names":["-V","--version"],"signature":"-V --version"},{"description":"The new user will bypass every row-level security (RLS) policy.","names":["--bypassrls"],"signature":"--bypassrls"},{"description":"The new user will not bypass row-level security (RLS) policies. This is the default.","names":["--no-bypassrls"],"signature":"--no-bypassrls"},{"description":"The new user will have the REPLICATION privilege, which is described more fully in the documentation for CREATE ROLE .","names":["--replication"],"signature":"--replication"},{"description":"The new user will not have the REPLICATION privilege, which is described more fully in the documentation for CREATE ROLE . This is the default.","names":["--no-replication"],"signature":"--no-replication"},{"description":"Show help about createuser command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help"},{"description":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.","names":["-h host","--host= host"],"signature":"-h host --host= host"},{"description":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.","names":["-p port","--port= port"],"signature":"-p port --port= port"},{"description":"User name to connect as (not the user name to create).","names":["-U username","--username= username"],"signature":"-U username --username= username"},{"description":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .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.","names":["-w","--no-password"],"signature":"-w --no-password"},{"description":"Force createuser to prompt for a password (for connecting to the server, not for the password of the new user). This option is never essential, since createuser will automatically prompt for a password if the server demands password authentication. However, createuser will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.","names":["-W","--password"],"signature":"-W --password"}],"synopsis":["createuser [ connection-option ...] [ option ...] [ username ]"]},"comparison_hash":"a799786c932cad0cf5beb0247529a9915a47614f3c76662e3d36b4748f38780d","description":["createuser — define a new PostgreSQL user account"],"description_zh":"描述 createuser 创建一个新的 PostgreSQL 用户（更准确地说，是一个角色）。只有超级用户以及具有 CREATEROLE 权限的用户才能创建新用户，因此调用 createuser 的用户必须能够以超级用户或具有 CREATEROLE 权限的用户身份连接。 如果要创建一个具有 SUPERUSER 、 REPLICATION 或 BYPASSRLS 权限的角色，则必须以超级用户身份连接，而不能仅具有 CREATEROLE 权限。超级用户意味着能够绕过数据库中的所有访问权限检查，因此不应轻易授予超级用户权限。 CREATEROLE 也赋予 非常广泛的权限 。 createuser 是 SQL 命令 CREATE ROLE 的一个包装器。通过此工具创建用户与通过其他访问服务器的方法创建用户，在效果上没有区别。 选项 createuser 接受下列命令行参数： username 指定要创建的 PostgreSQL 用户名。该名称必须不同于此 PostgreSQL 安装中的所有现有角色名称。 -a role --with-admin= role 指定一个现有角色，使其自动作为带有 ADMIN OPTION 的成员加入新角色，从而有权将新角色的成员资格授予其他角色。可以通过写多个 -a 开关来指定多个现有角色。 -c number --connection-limit= number 为新用户设置最大连接数。默认不设限制。 -d --createdb 允许新用户创建数据库。 -D --no-createdb 不允许新用户创建数据库。这是默认设置。 -e --echo 回显 createuser 生成并发送给服务器的命令。 -E --encrypted 该选项已废弃，但为了向后兼容仍被接受。 -g role --member-of= role --role= role （已弃用） 指定新角色应自动成为指定现有角色的成员。可以通过写多个 -g 开关来指定多个现有角色。 -i --inherit 新角色将自动继承其所属角色的权限。这是默认设置。 -I --no-inher","description_zh_html":"\u003cp\u003e命令行工具 createuser [ connection-option ...] [ option ...] [ username ]。\u003c/p\u003e\u003ch3\u003e同版本中文手册节选\u003c/h3\u003e\u003cdiv class=\"refsect1\"\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e 创建一个新的 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 用户（更准确地说，是一个角色）。只有超级用户以及具有 \u003ccode class=\"literal\"\u003eCREATEROLE\u003c/code\u003e 权限的用户才能创建新用户，因此调用 \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e 的用户必须能够以超级用户或具有 \u003ccode class=\"literal\"\u003eCREATEROLE\u003c/code\u003e 权限的用户身份连接。\n  \u003c/p\u003e\u003cp\u003e\n   如果要创建一个具有 \u003ccode class=\"literal\"\u003eSUPERUSER\u003c/code\u003e、\u003ccode class=\"literal\"\u003eREPLICATION\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003eBYPASSRLS\u003c/code\u003e 权限的角色，则必须以超级用户身份连接，而不能仅具有 \u003ccode class=\"literal\"\u003eCREATEROLE\u003c/code\u003e 权限。超级用户意味着能够绕过数据库中的所有访问权限检查，因此不应轻易授予超级用户权限。\u003ccode class=\"literal\"\u003eCREATEROLE\u003c/code\u003e 也赋予\u003ca class=\"link\" href=\"/zh/docs/18/role-attributes.html#ROLE-CREATION\"\u003e非常广泛的权限\u003c/a\u003e。\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e 是 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 命令 \u003ca class=\"link\" href=\"/zh/docs/18/sql-createrole.html\"\u003e\u003ccode class=\"command\"\u003eCREATE ROLE\u003c/code\u003e\u003c/a\u003e 的一个包装器。通过此工具创建用户与通过其他访问服务器的方法创建用户，在效果上没有区别。\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\"\u003e\u003ch2\u003e选项\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e 接受下列命令行参数：\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定要创建的 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 用户名。该名称必须不同于此 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 安装中的所有现有角色名称。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-a \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--with-admin=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定一个现有角色，使其自动作为带有 ADMIN OPTION 的成员加入新角色，从而有权将新角色的成员资格授予其他角色。可以通过写多个 \u003ccode class=\"option\"\u003e-a\u003c/code\u003e 开关来指定多个现有角色。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c \u003cem class=\"replaceable\"\u003e\u003ccode\u003enumber\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--connection-limit=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enumber\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        为新用户设置最大连接数。默认不设限制。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--createdb\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        允许新用户创建数据库。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-D\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-createdb\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不允许新用户创建数据库。这是默认设置。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        回显 \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e 生成并发送给服务器的命令。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--encrypted\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        该选项已废弃，但为了向后兼容仍被接受。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-g \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--member-of=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--role=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e（已弃用）\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定新角色应自动成为指定现有角色的成员。可以通过写多个 \u003ccode class=\"option\"\u003e-g\u003c/code\u003e 开关来指定多个现有角色。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-i\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--inherit\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        新角色将自动继承其所属角色的权限。这是默认设置。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-I\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-inherit\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        新角色将不会自动继承其所属角色的权限。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--interactive\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        如果命令行中未指定用户名，则提示输入用户名；此外，还会提示输入命令行中未指定的\n        \u003ccode class=\"option\"\u003e-d\u003c/code\u003e/\u003ccode class=\"option\"\u003e-D\u003c/code\u003e、\u003ccode class=\"option\"\u003e-r\u003c/code\u003e/\u003ccode class=\"option\"\u003e-R\u003c/code\u003e、\u003ccode class=\"option\"\u003e-s\u003c/code\u003e/\u003ccode class=\"option\"\u003e-S\u003c/code\u003e 选项。（直到 PostgreSQL 9.1 为止，这都是默认行为。）\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--login\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        允许新用户登录（也就是说，该用户名可用作初始会话用户标识符）。这是默认设置。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-L\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-login\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不允许新用户登录。（不具有登录权限的角色仍可用于管理数据库权限。）\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-m \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--with-member=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定一个现有角色，使其自动作为成员加入新角色。可以通过写多个 \u003ccode class=\"option\"\u003e-m\u003c/code\u003e 开关来指定多个现有角色。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--pwprompt\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        如果给出此选项，\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e 会提示输入新用户的密码。如果不打算使用密码认证，则不需要这样做。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-r\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--createrole\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        允许新用户创建、更改、删除其他角色，对其添加注释，以及更改其安全标签；也就是说，该用户将具有 \u003ccode class=\"literal\"\u003eCREATEROLE\u003c/code\u003e 权限。关于该权限赋予哪些能力的更多细节，见\u003ca class=\"xref\" href=\"/zh/docs/18/role-attributes.html#ROLE-CREATION\"\u003e创建角色\u003c/a\u003e。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-R\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-createrole\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不允许新用户创建新角色。这是默认设置。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--superuser\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        新用户将成为超级用户。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-superuser\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        新用户将不是超级用户。这是默认设置。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v \u003cem class=\"replaceable\"\u003e\u003ccode\u003etimestamp\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--valid-until=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etimestamp\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置一个日期和时间，在此之后该角色的密码将不再有效。默认不设置密码过期日期。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        打印 \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e 版本并退出。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--bypassrls\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        新用户将绕过每一条行级安全（RLS）策略。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-bypassrls\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        新用户将不会绕过行级安全（RLS）策略。这是默认设置。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--replication\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        新用户将具有 \u003ccode class=\"literal\"\u003eREPLICATION\u003c/code\u003e 权限，关于该权限的更完整说明见 \u003ca class=\"xref\" href=\"/zh/docs/18/sql-createrole.html\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE ROLE\u003c/span\u003e\u003c/a\u003e。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-replication\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        新用户将不具有 \u003ccode class=\"literal\"\u003eREPLICATION\u003c/code\u003e 权限，关于该权限的更完整说明见 \u003ca class=\"xref\" href=\"/zh/docs/18/sql-createrole.html\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE ROLE\u003c/span\u003e\u003c/a\u003e。这是默认设置。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        显示有关 \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e 命令行参数的帮助并退出。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e 也接受下列用于连接参数的命令行参数：\n\n   \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定服务器所在主机的主机名。如果该值以斜杠开头，则将其用作 Unix 域套接字所在目录。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定服务器监听连接所用的 TCP 端口或本地 Unix 域套接字文件扩展名。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定连接时使用的用户名（不是要创建的用户名）。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        绝不提示输入密码。如果服务器要求密码认证，而密码又无法通过诸如\u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e 文件等其他方式获得，则连接尝试将失败。该选项可用于没有用户在场输入密码的批处理作业和脚本。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        强制 \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e 提示输入密码（用于连接到服务器，而不是新用户的密码）。\n       \u003c/p\u003e\u003cp\u003e\n        该选项绝非必需，因为如果服务器要求密码认证，\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e 会自动提示输入密码。不过，\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e 会浪费一次连接尝试来发现服务器需要密码。在某些情况下，输入 \u003ccode class=\"option\"\u003e-W\u003c/code\u003e 可以避免这次额外的连接尝试。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/div\u003e\u003cp\u003e\u003ca href=\"/zh/docs/18/app-createuser.html\"\u003e查看完整中文手册与上下文\u003c/a\u003e。\u003c/p\u003e","environment":[{"description":"Default connection parameters","name":"PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"facts":[{"label":"Documented executable","value":"createuser"},{"label":"Executable version","value":"18.6"},{"label":"Reference inventory","value":"Client applications"},{"label":"Option definition groups","value":"30"}],"facts_zh":[{"label":"手册中的可执行程序","value":"createuser"},{"label":"程序版本","value":"18.6"},{"label":"参考清单","value":"客户端程序"},{"label":"选项定义组","value":"30"}],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-CREATEUSER\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003ecreateuser — define a new \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e user account\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.5.4.1\"\u003e\u003ccode class=\"command\"\u003ecreateuser\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.5.5\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e creates a new \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e user (or more precisely, a role). Only superusers and users with \u003ccode class=\"literal\"\u003eCREATEROLE\u003c/code\u003e privilege can create new users, so \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e must be invoked by someone who can connect as a superuser or a user with \u003ccode class=\"literal\"\u003eCREATEROLE\u003c/code\u003e privilege.\u003c/p\u003e\n\u003cp\u003eIf you wish to create a role with the \u003ccode class=\"literal\"\u003eSUPERUSER\u003c/code\u003e, \u003ccode class=\"literal\"\u003eREPLICATION\u003c/code\u003e, or \u003ccode class=\"literal\"\u003eBYPASSRLS\u003c/code\u003e privilege, you must connect as a superuser, not merely with \u003ccode class=\"literal\"\u003eCREATEROLE\u003c/code\u003e privilege. Being a superuser implies the ability to bypass all access permission checks within the database, so superuser access should not be granted lightly. \u003ccode class=\"literal\"\u003eCREATEROLE\u003c/code\u003e also conveys \u003ca class=\"link\" href=\"/docs/18/role-attributes.html#ROLE-CREATION\"\u003every extensive privileges\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e is a wrapper around the SQL command \u003ca class=\"link\" href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\"\u003e\u003ccode class=\"command\"\u003eCREATE ROLE\u003c/code\u003e\u003c/a\u003e. There is no effective difference between creating users via this utility and via other methods for accessing the server.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.5.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e accepts the following command-line arguments:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e user to be created. This name must be different from all existing roles in this \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-a \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--with-admin=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies an existing role that will be automatically added as a member of the new role with admin option, giving it the right to grant membership in the new role to others. Multiple existing roles can be specified by writing multiple \u003ccode class=\"option\"\u003e-a\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c \u003cem class=\"replaceable\"\u003e\u003ccode\u003enumber\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--connection-limit=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enumber\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSet a maximum number of connections for the new user. The default is to set no limit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--createdb\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will be allowed to create databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-D\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-createdb\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not be allowed to create databases. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEcho the commands that \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e generates and sends to the server.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--encrypted\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is obsolete but still accepted for backward compatibility.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-g \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--member-of=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--role=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e (deprecated)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the new role should be automatically added as a member of the specified existing role. Multiple existing roles can be specified by writing multiple \u003ccode class=\"option\"\u003e-g\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-i\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--inherit\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new role will automatically inherit privileges of roles it is a member of. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-I\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-inherit\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new role will not automatically inherit privileges of roles it is a member of.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--interactive\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrompt for the user name if none is specified on the command line, and also prompt for whichever of the options \u003ccode class=\"option\"\u003e-d\u003c/code\u003e/\u003ccode class=\"option\"\u003e-D\u003c/code\u003e, \u003ccode class=\"option\"\u003e-r\u003c/code\u003e/\u003ccode class=\"option\"\u003e-R\u003c/code\u003e, \u003ccode class=\"option\"\u003e-s\u003c/code\u003e/\u003ccode class=\"option\"\u003e-S\u003c/code\u003e is not specified on the command line. (This was the default behavior up to PostgreSQL 9.1.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--login\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will be allowed to log in (that is, the user name can be used as the initial session user identifier). This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-L\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-login\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not be allowed to log in. (A role without login privilege is still useful as a means of managing database permissions.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-m \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--with-member=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies an existing role that will be automatically added as a member of the new role. Multiple existing roles can be specified by writing multiple \u003ccode class=\"option\"\u003e-m\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--pwprompt\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIf given, \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e will issue a prompt for the password of the new user. This is not necessary if you do not plan on using password authentication.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-r\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--createrole\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will be allowed to create, alter, drop, comment on, change the security label for other roles; that is, this user will have \u003ccode class=\"literal\"\u003eCREATEROLE\u003c/code\u003e privilege. See \u003ca class=\"xref\" href=\"/docs/18/role-attributes.html#ROLE-CREATION\"\u003erole creation\u003c/a\u003e for more details about what capabilities are conferred by this privilege.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-R\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-createrole\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not be allowed to create new roles. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--superuser\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will be a superuser.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-superuser\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not be a superuser. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v \u003cem class=\"replaceable\"\u003e\u003ccode\u003etimestamp\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--valid-until=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etimestamp\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSet a date and time after which the role's password is no longer valid. The default is to set no password expiry date.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--bypassrls\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will bypass every row-level security (RLS) policy.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-bypassrls\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not bypass row-level security (RLS) policies. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--replication\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will have the \u003ccode class=\"literal\"\u003eREPLICATION\u003c/code\u003e privilege, which is described more fully in the documentation for \u003ca class=\"xref\" href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE ROLE\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-replication\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not have the \u003ccode class=\"literal\"\u003eREPLICATION\u003c/code\u003e privilege, which is described more fully in the documentation for \u003ca class=\"xref\" href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE ROLE\u003c/span\u003e\u003c/a\u003e. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e also accepts the following command-line arguments for connection parameters:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as (not the user name to create).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e 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.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e to prompt for a password (for connecting to the server, not for the password of the new user).\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.5.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.5.8\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003eIn case of difficulty, see \u003ca class=\"xref\" href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE ROLE\u003c/span\u003e\u003c/a\u003e and \u003ca class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e front-end library will apply.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.5.9\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo create a user \u003ccode class=\"literal\"\u003ejoe\u003c/code\u003e on the default database server:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ecreateuser joe\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo create a user \u003ccode class=\"literal\"\u003ejoe\u003c/code\u003e on the default database server with prompting for some additional attributes:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ecreateuser --interactive joe\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eShall the new role be a superuser? (y/n) \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eShall the new role be allowed to create databases? (y/n) \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eShall the new role be allowed to create more new roles? (y/n) \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo create the same user \u003ccode class=\"literal\"\u003ejoe\u003c/code\u003e using the server on host \u003ccode class=\"literal\"\u003eeden\u003c/code\u003e, port 5000, with attributes explicitly specified, taking a look at the underlying command:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ecreateuser -h eden -p 5000 -S -D -R -e joe\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eCREATE ROLE joe NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\u003c/code\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo create the user \u003ccode class=\"literal\"\u003ejoe\u003c/code\u003e as a superuser, and assign a password immediately:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ecreateuser -P -s -e joe\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eEnter password for new role: \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003exyzzy\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eEnter it again: \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003exyzzy\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eCREATE ROLE joe PASSWORD 'SCRAM-SHA-256$4096:44560wPMLfjqiAzyPDZ/eQ==$4CA054rZlSFEq8Z3FEhToBTa2X6KnWFxFkPwIbKoDe0=:L/nbSZRCjp6RhOhKK56GoR1zibCCSePKshCJ9lnl3yw=' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN NOREPLICATION NOBYPASSRLS;\u003c/code\u003e\n\u003c/pre\u003e\n\u003cp\u003eIn the above example, the new password isn't actually echoed when typed, but we show what was typed for clarity. As you see, the password is encrypted before it is sent to the client.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.5.10\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/app-dropuser.html\" title=\"dropuser\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003edropuser\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE ROLE\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-CREATEROLE-SELF-GRANT\"\u003ecreaterole_self_grant\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","manual_path":"app-createuser.html","options":[{"description":"Specifies an existing role that will be automatically added as a member of the new role with admin option, giving it the right to grant membership in the new role to others. Multiple existing roles can be specified by writing multiple -a switches.","names":["-a role","--with-admin= role"],"signature":"-a role --with-admin= role","source_url":"/docs/18/app-createuser.html","summary":"Specifies an existing role that will be automatically added as a member of the new role with admin option, giving it the right to grant membership in the new role to others. Multiple existing roles can be specified by writing multiple -a switches."},{"description":"Set a maximum number of connections for the new user. The default is to set no limit.","names":["-c number","--connection-limit= number"],"signature":"-c number --connection-limit= number","source_url":"/docs/18/app-createuser.html","summary":"Set a maximum number of connections for the new user. The default is to set no limit."},{"description":"The new user will be allowed to create databases.","names":["-d","--createdb"],"signature":"-d --createdb","source_url":"/docs/18/app-createuser.html","summary":"The new user will be allowed to create databases."},{"description":"The new user will not be allowed to create databases. This is the default.","names":["-D","--no-createdb"],"signature":"-D --no-createdb","source_url":"/docs/18/app-createuser.html","summary":"The new user will not be allowed to create databases. This is the default."},{"description":"Echo the commands that createuser generates and sends to the server.","names":["-e","--echo"],"signature":"-e --echo","source_url":"/docs/18/app-createuser.html","summary":"Echo the commands that createuser generates and sends to the server."},{"description":"This option is obsolete but still accepted for backward compatibility.","names":["-E","--encrypted"],"signature":"-E --encrypted","source_url":"/docs/18/app-createuser.html","summary":"This option is obsolete but still accepted for backward compatibility."},{"description":"Specifies the new role should be automatically added as a member of the specified existing role. Multiple existing roles can be specified by writing multiple -g switches.","names":["-g role","--member-of= role","--role= role"],"signature":"-g role --member-of= role --role= role (deprecated)","source_url":"/docs/18/app-createuser.html","summary":"Specifies the new role should be automatically added as a member of the specified existing role. Multiple existing roles can be specified by writing multiple -g switches."},{"description":"The new role will automatically inherit privileges of roles it is a member of. This is the default.","names":["-i","--inherit"],"signature":"-i --inherit","source_url":"/docs/18/app-createuser.html","summary":"The new role will automatically inherit privileges of roles it is a member of. This is the default."},{"description":"The new role will not automatically inherit privileges of roles it is a member of.","names":["-I","--no-inherit"],"signature":"-I --no-inherit","source_url":"/docs/18/app-createuser.html","summary":"The new role will not automatically inherit privileges of roles it is a member of."},{"description":"Prompt for the user name if none is specified on the command line, and also prompt for whichever of the options -d / -D , -r / -R , -s / -S is not specified on the command line. (This was the default behavior up to PostgreSQL 9.1.)","names":["--interactive"],"signature":"--interactive","source_url":"/docs/18/app-createuser.html","summary":"Prompt for the user name if none is specified on the command line, and also prompt for whichever of the options -d / -D , -r / -R , -s / -S is not specified on the command line. (This was the default behavior up to PostgreSQL 9.1.)"},{"description":"The new user will be allowed to log in (that is, the user name can be used as the initial session user identifier). This is the default.","names":["-l","--login"],"signature":"-l --login","source_url":"/docs/18/app-createuser.html","summary":"The new user will be allowed to log in (that is, the user name can be used as the initial session user identifier). This is the default."},{"description":"The new user will not be allowed to log in. (A role without login privilege is still useful as a means of managing database permissions.)","names":["-L","--no-login"],"signature":"-L --no-login","source_url":"/docs/18/app-createuser.html","summary":"The new user will not be allowed to log in. (A role without login privilege is still useful as a means of managing database permissions.)"},{"description":"Specifies an existing role that will be automatically added as a member of the new role. Multiple existing roles can be specified by writing multiple -m switches.","names":["-m role","--with-member= role"],"signature":"-m role --with-member= role","source_url":"/docs/18/app-createuser.html","summary":"Specifies an existing role that will be automatically added as a member of the new role. Multiple existing roles can be specified by writing multiple -m switches."},{"description":"If given, createuser will issue a prompt for the password of the new user. This is not necessary if you do not plan on using password authentication.","names":["-P","--pwprompt"],"signature":"-P --pwprompt","source_url":"/docs/18/app-createuser.html","summary":"If given, createuser will issue a prompt for the password of the new user. This is not necessary if you do not plan on using password authentication."},{"description":"The new user will be allowed to create, alter, drop, comment on, change the security label for other roles; that is, this user will have CREATEROLE privilege. See role creation for more details about what capabilities are conferred by this privilege.","names":["-r","--createrole"],"signature":"-r --createrole","source_url":"/docs/18/app-createuser.html","summary":"The new user will be allowed to create, alter, drop, comment on, change the security label for other roles; that is, this user will have CREATEROLE privilege. See role creation for more details about what capabilities are conferred by this privilege."},{"description":"The new user will not be allowed to create new roles. This is the default.","names":["-R","--no-createrole"],"signature":"-R --no-createrole","source_url":"/docs/18/app-createuser.html","summary":"The new user will not be allowed to create new roles. This is the default."},{"description":"The new user will be a superuser.","names":["-s","--superuser"],"signature":"-s --superuser","source_url":"/docs/18/app-createuser.html","summary":"The new user will be a superuser."},{"description":"The new user will not be a superuser. This is the default.","names":["-S","--no-superuser"],"signature":"-S --no-superuser","source_url":"/docs/18/app-createuser.html","summary":"The new user will not be a superuser. This is the default."},{"description":"Set a date and time after which the role's password is no longer valid. The default is to set no password expiry date.","names":["-v timestamp","--valid-until= timestamp"],"signature":"-v timestamp --valid-until= timestamp","source_url":"/docs/18/app-createuser.html","summary":"Set a date and time after which the role's password is no longer valid. The default is to set no password expiry date."},{"description":"Print the createuser version and exit.","names":["-V","--version"],"signature":"-V --version","source_url":"/docs/18/app-createuser.html","summary":"Print the createuser version and exit."},{"description":"The new user will bypass every row-level security (RLS) policy.","names":["--bypassrls"],"signature":"--bypassrls","source_url":"/docs/18/app-createuser.html","summary":"The new user will bypass every row-level security (RLS) policy."},{"description":"The new user will not bypass row-level security (RLS) policies. This is the default.","names":["--no-bypassrls"],"signature":"--no-bypassrls","source_url":"/docs/18/app-createuser.html","summary":"The new user will not bypass row-level security (RLS) policies. This is the default."},{"description":"The new user will have the REPLICATION privilege, which is described more fully in the documentation for CREATE ROLE .","names":["--replication"],"signature":"--replication","source_url":"/docs/18/app-createuser.html","summary":"The new user will have the REPLICATION privilege, which is described more fully in the documentation for CREATE ROLE ."},{"description":"The new user will not have the REPLICATION privilege, which is described more fully in the documentation for CREATE ROLE . This is the default.","names":["--no-replication"],"signature":"--no-replication","source_url":"/docs/18/app-createuser.html","summary":"The new user will not have the REPLICATION privilege, which is described more fully in the documentation for CREATE ROLE . This is the default."},{"description":"Show help about createuser command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help","source_url":"/docs/18/app-createuser.html","summary":"Show help about createuser command line arguments, and exit."},{"description":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.","names":["-h host","--host= host"],"signature":"-h host --host= host","source_url":"/docs/18/app-createuser.html","summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket."},{"description":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.","names":["-p port","--port= port"],"signature":"-p port --port= port","source_url":"/docs/18/app-createuser.html","summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections."},{"description":"User name to connect as (not the user name to create).","names":["-U username","--username= username"],"signature":"-U username --username= username","source_url":"/docs/18/app-createuser.html","summary":"User name to connect as (not the user name to create)."},{"description":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .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.","names":["-w","--no-password"],"signature":"-w --no-password","source_url":"/docs/18/app-createuser.html","summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .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."},{"description":"Force createuser to prompt for a password (for connecting to the server, not for the password of the new user). This option is never essential, since createuser will automatically prompt for a password if the server demands password authentication. However, createuser will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.","names":["-W","--password"],"signature":"-W --password","source_url":"/docs/18/app-createuser.html","summary":"Force createuser to prompt for a password (for connecting to the server, not for the password of the new user)."}],"related":[],"release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sections":[],"sections_zh":[],"signature":"createuser [ connection-option ...] [ option ...] [ username ]","sources":[{"anchor":"","file":"app-createuser.html","label":"18.6 English manual · app-createuser.html","sha256":"32e83037eea6747b012d7ebf7c5cea18a037b940b9458ac0b13953a1f1535bd9","url":"/docs/18/app-createuser.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}],"synopsis":["createuser [ connection-option ...] [ option ...] [ username ]"],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-a role --with-admin= role","url":"/docs/18/app-createuser.html"},"summary":"Specifies an existing role that will be automatically added as a member of the new role with admin option, giving it the right to grant membership in the new role to others. Multiple existing roles can be specified by writing multiple -a switches."},{"signature":{"text":"-c number --connection-limit= number","url":"/docs/18/app-createuser.html"},"summary":"Set a maximum number of connections for the new user. The default is to set no limit."},{"signature":{"text":"-d --createdb","url":"/docs/18/app-createuser.html"},"summary":"The new user will be allowed to create databases."},{"signature":{"text":"-D --no-createdb","url":"/docs/18/app-createuser.html"},"summary":"The new user will not be allowed to create databases. This is the default."},{"signature":{"text":"-e --echo","url":"/docs/18/app-createuser.html"},"summary":"Echo the commands that createuser generates and sends to the server."},{"signature":{"text":"-E --encrypted","url":"/docs/18/app-createuser.html"},"summary":"This option is obsolete but still accepted for backward compatibility."},{"signature":{"text":"-g role --member-of= role --role= role (deprecated)","url":"/docs/18/app-createuser.html"},"summary":"Specifies the new role should be automatically added as a member of the specified existing role. Multiple existing roles can be specified by writing multiple -g switches."},{"signature":{"text":"-i --inherit","url":"/docs/18/app-createuser.html"},"summary":"The new role will automatically inherit privileges of roles it is a member of. This is the default."},{"signature":{"text":"-I --no-inherit","url":"/docs/18/app-createuser.html"},"summary":"The new role will not automatically inherit privileges of roles it is a member of."},{"signature":{"text":"--interactive","url":"/docs/18/app-createuser.html"},"summary":"Prompt for the user name if none is specified on the command line, and also prompt for whichever of the options -d / -D , -r / -R , -s / -S is not specified on the command line. (This was the default behavior up to PostgreSQL 9.1.)"},{"signature":{"text":"-l --login","url":"/docs/18/app-createuser.html"},"summary":"The new user will be allowed to log in (that is, the user name can be used as the initial session user identifier). This is the default."},{"signature":{"text":"-L --no-login","url":"/docs/18/app-createuser.html"},"summary":"The new user will not be allowed to log in. (A role without login privilege is still useful as a means of managing database permissions.)"},{"signature":{"text":"-m role --with-member= role","url":"/docs/18/app-createuser.html"},"summary":"Specifies an existing role that will be automatically added as a member of the new role. Multiple existing roles can be specified by writing multiple -m switches."},{"signature":{"text":"-P --pwprompt","url":"/docs/18/app-createuser.html"},"summary":"If given, createuser will issue a prompt for the password of the new user. This is not necessary if you do not plan on using password authentication."},{"signature":{"text":"-r --createrole","url":"/docs/18/app-createuser.html"},"summary":"The new user will be allowed to create, alter, drop, comment on, change the security label for other roles; that is, this user will have CREATEROLE privilege. See role creation for more details about what capabilities are conferred by this privilege."},{"signature":{"text":"-R --no-createrole","url":"/docs/18/app-createuser.html"},"summary":"The new user will not be allowed to create new roles. This is the default."},{"signature":{"text":"-s --superuser","url":"/docs/18/app-createuser.html"},"summary":"The new user will be a superuser."},{"signature":{"text":"-S --no-superuser","url":"/docs/18/app-createuser.html"},"summary":"The new user will not be a superuser. This is the default."},{"signature":{"text":"-v timestamp --valid-until= timestamp","url":"/docs/18/app-createuser.html"},"summary":"Set a date and time after which the role's password is no longer valid. The default is to set no password expiry date."},{"signature":{"text":"-V --version","url":"/docs/18/app-createuser.html"},"summary":"Print the createuser version and exit."},{"signature":{"text":"--bypassrls","url":"/docs/18/app-createuser.html"},"summary":"The new user will bypass every row-level security (RLS) policy."},{"signature":{"text":"--no-bypassrls","url":"/docs/18/app-createuser.html"},"summary":"The new user will not bypass row-level security (RLS) policies. This is the default."},{"signature":{"text":"--replication","url":"/docs/18/app-createuser.html"},"summary":"The new user will have the REPLICATION privilege, which is described more fully in the documentation for CREATE ROLE ."},{"signature":{"text":"--no-replication","url":"/docs/18/app-createuser.html"},"summary":"The new user will not have the REPLICATION privilege, which is described more fully in the documentation for CREATE ROLE . This is the default."},{"signature":{"text":"-? --help","url":"/docs/18/app-createuser.html"},"summary":"Show help about createuser command line arguments, and exit."},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-createuser.html"},"summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-createuser.html"},"summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-createuser.html"},"summary":"User name to connect as (not the user name to create)."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-createuser.html"},"summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .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."},{"signature":{"text":"-W --password","url":"/docs/18/app-createuser.html"},"summary":"Force createuser to prompt for a password (for connecting to the server, not for the password of the new user)."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"Default connection parameters","name":"PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"title":"Environment variables"}],"tables_zh":[{"columns":[{"key":"signature","label":"选项与参数"},{"key":"summary","label":"说明"}],"key":"options","rows":[{"signature":{"text":"-a role --with-admin= role","url":"/docs/18/app-createuser.html"},"summary":"指定一个现有角色，使其自动作为带有 ADMIN OPTION 的成员加入新角色，从而有权将新角色的成员资格授予其他角色。可以通过写多个 -a 开关来指定多个现有角色。"},{"signature":{"text":"-c number --connection-limit= number","url":"/docs/18/app-createuser.html"},"summary":"为新用户设置最大连接数。默认不设限制。"},{"signature":{"text":"-d --createdb","url":"/docs/18/app-createuser.html"},"summary":"允许新用户创建数据库。"},{"signature":{"text":"-D --no-createdb","url":"/docs/18/app-createuser.html"},"summary":"不允许新用户创建数据库。这是默认设置。"},{"signature":{"text":"-e --echo","url":"/docs/18/app-createuser.html"},"summary":"回显 createuser 生成并发送给服务器的命令。"},{"signature":{"text":"-E --encrypted","url":"/docs/18/app-createuser.html"},"summary":"该选项已废弃，但为了向后兼容仍被接受。"},{"signature":{"text":"-g role --member-of= role --role= role (deprecated)","url":"/docs/18/app-createuser.html"},"summary":"指定新角色应自动成为指定现有角色的成员。可以通过写多个 -g 开关来指定多个现有角色。"},{"signature":{"text":"-i --inherit","url":"/docs/18/app-createuser.html"},"summary":"新角色将自动继承其所属角色的权限。这是默认设置。"},{"signature":{"text":"-I --no-inherit","url":"/docs/18/app-createuser.html"},"summary":"新角色将不会自动继承其所属角色的权限。"},{"signature":{"text":"--interactive","url":"/docs/18/app-createuser.html"},"summary":"如果命令行未指定用户名，则提示输入；对于命令行中未指定的 -d/-D、-r/-R、-s/-S 选项，也会逐项提示。（直到 PostgreSQL 9.1，这都是默认行为。）"},{"signature":{"text":"-l --login","url":"/docs/18/app-createuser.html"},"summary":"允许新用户登录（也就是说，该用户名可用作初始会话用户标识符）。这是默认设置。"},{"signature":{"text":"-L --no-login","url":"/docs/18/app-createuser.html"},"summary":"不允许新用户登录。（不具有登录权限的角色仍可用于管理数据库权限。）"},{"signature":{"text":"-m role --with-member= role","url":"/docs/18/app-createuser.html"},"summary":"指定一个现有角色，使其自动作为成员加入新角色。可以通过写多个 -m 开关来指定多个现有角色。"},{"signature":{"text":"-P --pwprompt","url":"/docs/18/app-createuser.html"},"summary":"如果给出此选项， createuser 会提示输入新用户的密码。如果不打算使用密码认证，则不需要这样做。"},{"signature":{"text":"-r --createrole","url":"/docs/18/app-createuser.html"},"summary":"允许新用户创建、更改、删除其他角色，对其添加注释，以及更改其安全标签；也就是说，该用户将具有 CREATEROLE 权限。关于该权限赋予哪些能力的更多细节，见 创建角色 。"},{"signature":{"text":"-R --no-createrole","url":"/docs/18/app-createuser.html"},"summary":"不允许新用户创建新角色。这是默认设置。"},{"signature":{"text":"-s --superuser","url":"/docs/18/app-createuser.html"},"summary":"新用户将成为超级用户。"},{"signature":{"text":"-S --no-superuser","url":"/docs/18/app-createuser.html"},"summary":"新用户将不是超级用户。这是默认设置。"},{"signature":{"text":"-v timestamp --valid-until= timestamp","url":"/docs/18/app-createuser.html"},"summary":"设置一个日期和时间，在此之后该角色的密码将不再有效。默认不设置密码过期日期。"},{"signature":{"text":"-V --version","url":"/docs/18/app-createuser.html"},"summary":"打印 createuser 版本并退出。"},{"signature":{"text":"--bypassrls","url":"/docs/18/app-createuser.html"},"summary":"新用户将绕过每一条行级安全（RLS）策略。"},{"signature":{"text":"--no-bypassrls","url":"/docs/18/app-createuser.html"},"summary":"新用户将不会绕过行级安全（RLS）策略。这是默认设置。"},{"signature":{"text":"--replication","url":"/docs/18/app-createuser.html"},"summary":"新用户将具有 REPLICATION 权限，关于该权限的更完整说明见 CREATE ROLE 。"},{"signature":{"text":"--no-replication","url":"/docs/18/app-createuser.html"},"summary":"新用户将不具有 REPLICATION 权限，关于该权限的更完整说明见 CREATE ROLE 。这是默认设置。"},{"signature":{"text":"-? --help","url":"/docs/18/app-createuser.html"},"summary":"显示有关 createuser 命令行参数的帮助并退出。"},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-createuser.html"},"summary":"指定服务器所在主机的主机名。如果该值以斜杠开头，则将其用作 Unix 域套接字所在目录。"},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-createuser.html"},"summary":"指定服务器监听连接所用的 TCP 端口或本地 Unix 域套接字文件扩展名。"},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-createuser.html"},"summary":"指定连接时使用的用户名（不是要创建的用户名）。"},{"signature":{"text":"-w --no-password","url":"/docs/18/app-createuser.html"},"summary":"绝不提示输入密码。如果服务器要求密码认证，而密码又无法通过诸如 .pgpass 文件等其他方式获得，则连接尝试将失败。该选项可用于没有用户在场输入密码的批处理作业和脚本。"},{"signature":{"text":"-W --password","url":"/docs/18/app-createuser.html"},"summary":"强制 createuser 提示输入密码（用于连接到服务器，而不是新用户的密码）。"}],"title":"手册中的选项"},{"columns":[{"key":"name","label":"变量"},{"key":"description","label":"含义"}],"key":"environment","rows":[{"description":"默认连接参数","name":"PGHOST PGPORT PGUSER"},{"description":"指定诊断消息是否使用颜色。可选值为 always 、 auto 和 never 。","name":"PG_COLOR"}],"title":"环境变量"}],"zh_from":{"authored_translation":"source-derived-identity","body_sha256":"9703c86e905098d1396da32bef41b7f748f7615274ed019bc5af7537b097f253","kind":"same-version-chinese-manual-with-source-derived-identity","manual":{"anchor":"","build_id":107,"extraction":"command-description-and-options","fragment_sha256":"b4e3b04feec655725d746220babcff36931749a49f7c07e421c629e854327325","locale":"zh-Hans","page_key":"app-createuser.html","source_hash":"25feb732c3f4793b74ad0b77b7950db0c29c1634e3c04ed1a1caa7be71df26b7","source_revision":"unknown:rendered-translation-baseline","translated_from_revision":null,"translation_revision":"git:b1b500221dbe5437cfca004d6b04d3f6e422765d;html-sha256:08e987a66af27b98444a8057c256314eafa13611a3fb9e888214fc436824244b","url":"/zh/docs/18/app-createuser.html","version":"18"},"runtime_rerun":false,"source_facts_revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8"}},"ManualEvidence":{"manual_path":"app-createuser.html","release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sources":[{"anchor":"","file":"app-createuser.html","label":"18.6 English manual · app-createuser.html","sha256":"32e83037eea6747b012d7ebf7c5cea18a037b940b9458ac0b13953a1f1535bd9","url":"/docs/18/app-createuser.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}]},"MeasuredEvidence":{}},"Text":{"Collection":"tool","Key":"createuser","SourceDatabase":"center","Version":"18","Locale":"en","Title":"createuser","Summary":"createuser — define a new PostgreSQL user account","BodyHTML":"\u003cdiv\u003e\u003cdiv id=\"APP-CREATEUSER\"\u003e\n\u003cdiv\u003e\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003e\u003cspan\u003e\u003cspan\u003ecreateuser\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003ecreateuser — define a new \u003cspan\u003ePostgreSQL\u003c/span\u003e user account\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cp id=\"id-1.9.4.5.4.1\"\u003e\u003ccode\u003ecreateuser\u003c/code\u003e [\u003cem\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [\u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.5.5\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003ecreateuser\u003c/span\u003e creates a new \u003cspan\u003ePostgreSQL\u003c/span\u003e user (or more precisely, a role). Only superusers and users with \u003ccode\u003eCREATEROLE\u003c/code\u003e privilege can create new users, so \u003cspan\u003ecreateuser\u003c/span\u003e must be invoked by someone who can connect as a superuser or a user with \u003ccode\u003eCREATEROLE\u003c/code\u003e privilege.\u003c/p\u003e\n\u003cp\u003eIf you wish to create a role with the \u003ccode\u003eSUPERUSER\u003c/code\u003e, \u003ccode\u003eREPLICATION\u003c/code\u003e, or \u003ccode\u003eBYPASSRLS\u003c/code\u003e privilege, you must connect as a superuser, not merely with \u003ccode\u003eCREATEROLE\u003c/code\u003e privilege. Being a superuser implies the ability to bypass all access permission checks within the database, so superuser access should not be granted lightly. \u003ccode\u003eCREATEROLE\u003c/code\u003e also conveys \u003ca href=\"/docs/18/role-attributes.html#ROLE-CREATION\" rel=\"nofollow\"\u003every extensive privileges\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003ecreateuser\u003c/span\u003e is a wrapper around the SQL command \u003ca href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\" rel=\"nofollow\"\u003e\u003ccode\u003eCREATE ROLE\u003c/code\u003e\u003c/a\u003e. There is no effective difference between creating users via this utility and via other methods for accessing the server.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.5.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003ecreateuser\u003c/span\u003e accepts the following command-line arguments:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the \u003cspan\u003ePostgreSQL\u003c/span\u003e user to be created. This name must be different from all existing roles in this \u003cspan\u003ePostgreSQL\u003c/span\u003e installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-a \u003cem\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--with-admin=\u003cem\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies an existing role that will be automatically added as a member of the new role with admin option, giving it the right to grant membership in the new role to others. Multiple existing roles can be specified by writing multiple \u003ccode\u003e-a\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-c \u003cem\u003e\u003ccode\u003enumber\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--connection-limit=\u003cem\u003e\u003ccode\u003enumber\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSet a maximum number of connections for the new user. The default is to set no limit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-d\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--createdb\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will be allowed to create databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-D\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-createdb\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not be allowed to create databases. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--echo\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEcho the commands that \u003cspan\u003ecreateuser\u003c/span\u003e generates and sends to the server.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-E\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--encrypted\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is obsolete but still accepted for backward compatibility.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-g \u003cem\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--member-of=\u003cem\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--role=\u003cem\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e (deprecated)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the new role should be automatically added as a member of the specified existing role. Multiple existing roles can be specified by writing multiple \u003ccode\u003e-g\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-i\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--inherit\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new role will automatically inherit privileges of roles it is a member of. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-I\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-inherit\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new role will not automatically inherit privileges of roles it is a member of.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--interactive\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrompt for the user name if none is specified on the command line, and also prompt for whichever of the options \u003ccode\u003e-d\u003c/code\u003e/\u003ccode\u003e-D\u003c/code\u003e, \u003ccode\u003e-r\u003c/code\u003e/\u003ccode\u003e-R\u003c/code\u003e, \u003ccode\u003e-s\u003c/code\u003e/\u003ccode\u003e-S\u003c/code\u003e is not specified on the command line. (This was the default behavior up to PostgreSQL 9.1.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-l\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--login\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will be allowed to log in (that is, the user name can be used as the initial session user identifier). This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-L\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-login\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not be allowed to log in. (A role without login privilege is still useful as a means of managing database permissions.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-m \u003cem\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--with-member=\u003cem\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies an existing role that will be automatically added as a member of the new role. Multiple existing roles can be specified by writing multiple \u003ccode\u003e-m\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-P\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--pwprompt\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIf given, \u003cspan\u003ecreateuser\u003c/span\u003e will issue a prompt for the password of the new user. This is not necessary if you do not plan on using password authentication.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-r\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--createrole\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will be allowed to create, alter, drop, comment on, change the security label for other roles; that is, this user will have \u003ccode\u003eCREATEROLE\u003c/code\u003e privilege. See \u003ca href=\"/docs/18/role-attributes.html#ROLE-CREATION\" rel=\"nofollow\"\u003erole creation\u003c/a\u003e for more details about what capabilities are conferred by this privilege.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-R\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-createrole\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not be allowed to create new roles. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--superuser\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will be a superuser.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-S\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-superuser\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not be a superuser. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-v \u003cem\u003e\u003ccode\u003etimestamp\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--valid-until=\u003cem\u003e\u003ccode\u003etimestamp\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSet a date and time after which the role\u0026#39;s password is no longer valid. The default is to set no password expiry date.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan\u003ecreateuser\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--bypassrls\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will bypass every row-level security (RLS) policy.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-bypassrls\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not bypass row-level security (RLS) policies. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--replication\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will have the \u003ccode\u003eREPLICATION\u003c/code\u003e privilege, which is described more fully in the documentation for \u003ca href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE ROLE\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-replication\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not have the \u003ccode\u003eREPLICATION\u003c/code\u003e privilege, which is described more fully in the documentation for \u003ca href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE ROLE\u003c/span\u003e\u003c/a\u003e. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan\u003ecreateuser\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003cspan\u003ecreateuser\u003c/span\u003e also accepts the following command-line arguments for connection parameters:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-h \u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--host=\u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-p \u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--port=\u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-U \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--username=\u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as (not the user name to create).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode\u003e.pgpass\u003c/code\u003e 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.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan\u003ecreateuser\u003c/span\u003e to prompt for a password (for connecting to the server, not for the password of the new user).\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan\u003ecreateuser\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan\u003ecreateuser\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.5.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode\u003ealways\u003c/code\u003e, \u003ccode\u003eauto\u003c/code\u003e and \u003ccode\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan\u003elibpq\u003c/span\u003e (see \u003ca href=\"/docs/18/libpq-envars.html\" rel=\"nofollow\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.5.8\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003eIn case of difficulty, see \u003ca href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE ROLE\u003c/span\u003e\u003c/a\u003e and \u003ca href=\"/docs/18/app-psql.html\" title=\"psql\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the \u003cspan\u003elibpq\u003c/span\u003e front-end library will apply.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.5.9\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo create a user \u003ccode\u003ejoe\u003c/code\u003e on the default database server:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$ \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003ecreateuser joe\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo create a user \u003ccode\u003ejoe\u003c/code\u003e on the default database server with prompting for some additional attributes:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$ \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003ecreateuser --interactive joe\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003eShall the new role be a superuser? (y/n) \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003en\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003eShall the new role be allowed to create databases? (y/n) \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003en\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003eShall the new role be allowed to create more new roles? (y/n) \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003en\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo create the same user \u003ccode\u003ejoe\u003c/code\u003e using the server on host \u003ccode\u003eeden\u003c/code\u003e, port 5000, with attributes explicitly specified, taking a look at the underlying command:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$ \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003ecreateuser -h eden -p 5000 -S -D -R -e joe\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003eCREATE ROLE joe NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\u003c/code\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo create the user \u003ccode\u003ejoe\u003c/code\u003e as a superuser, and assign a password immediately:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$ \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003ecreateuser -P -s -e joe\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003eEnter password for new role: \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003exyzzy\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003eEnter it again: \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003exyzzy\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003eCREATE ROLE joe PASSWORD \u0026#39;SCRAM-SHA-256$4096:44560wPMLfjqiAzyPDZ/eQ==$4CA054rZlSFEq8Z3FEhToBTa2X6KnWFxFkPwIbKoDe0=:L/nbSZRCjp6RhOhKK56GoR1zibCCSePKshCJ9lnl3yw=\u0026#39; SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN NOREPLICATION NOBYPASSRLS;\u003c/code\u003e\n\u003c/pre\u003e\n\u003cp\u003eIn the above example, the new password isn\u0026#39;t actually echoed when typed, but we show what was typed for clarity. As you see, the password is encrypted before it is sent to the client.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.5.10\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/docs/18/app-dropuser.html\" title=\"dropuser\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003edropuser\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE ROLE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/runtime-config-client.html#GUC-CREATEROLE-SELF-GRANT\" rel=\"nofollow\"\u003ecreaterole_self_grant\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","ContentHash":"34b0355edf48f44e69d4ecde14f68d6ec500aa64bc356bcd22256dd8b6ba7c06","Payload":{"description":["createuser — define a new PostgreSQL user account"],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-CREATEUSER\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003ecreateuser — define a new \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e user account\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.5.4.1\"\u003e\u003ccode class=\"command\"\u003ecreateuser\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.5.5\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e creates a new \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e user (or more precisely, a role). Only superusers and users with \u003ccode class=\"literal\"\u003eCREATEROLE\u003c/code\u003e privilege can create new users, so \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e must be invoked by someone who can connect as a superuser or a user with \u003ccode class=\"literal\"\u003eCREATEROLE\u003c/code\u003e privilege.\u003c/p\u003e\n\u003cp\u003eIf you wish to create a role with the \u003ccode class=\"literal\"\u003eSUPERUSER\u003c/code\u003e, \u003ccode class=\"literal\"\u003eREPLICATION\u003c/code\u003e, or \u003ccode class=\"literal\"\u003eBYPASSRLS\u003c/code\u003e privilege, you must connect as a superuser, not merely with \u003ccode class=\"literal\"\u003eCREATEROLE\u003c/code\u003e privilege. Being a superuser implies the ability to bypass all access permission checks within the database, so superuser access should not be granted lightly. \u003ccode class=\"literal\"\u003eCREATEROLE\u003c/code\u003e also conveys \u003ca class=\"link\" href=\"/docs/18/role-attributes.html#ROLE-CREATION\"\u003every extensive privileges\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e is a wrapper around the SQL command \u003ca class=\"link\" href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\"\u003e\u003ccode class=\"command\"\u003eCREATE ROLE\u003c/code\u003e\u003c/a\u003e. There is no effective difference between creating users via this utility and via other methods for accessing the server.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.5.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e accepts the following command-line arguments:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e user to be created. This name must be different from all existing roles in this \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-a \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--with-admin=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies an existing role that will be automatically added as a member of the new role with admin option, giving it the right to grant membership in the new role to others. Multiple existing roles can be specified by writing multiple \u003ccode class=\"option\"\u003e-a\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c \u003cem class=\"replaceable\"\u003e\u003ccode\u003enumber\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--connection-limit=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enumber\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSet a maximum number of connections for the new user. The default is to set no limit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--createdb\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will be allowed to create databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-D\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-createdb\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not be allowed to create databases. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEcho the commands that \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e generates and sends to the server.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--encrypted\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is obsolete but still accepted for backward compatibility.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-g \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--member-of=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--role=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e (deprecated)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the new role should be automatically added as a member of the specified existing role. Multiple existing roles can be specified by writing multiple \u003ccode class=\"option\"\u003e-g\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-i\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--inherit\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new role will automatically inherit privileges of roles it is a member of. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-I\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-inherit\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new role will not automatically inherit privileges of roles it is a member of.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--interactive\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrompt for the user name if none is specified on the command line, and also prompt for whichever of the options \u003ccode class=\"option\"\u003e-d\u003c/code\u003e/\u003ccode class=\"option\"\u003e-D\u003c/code\u003e, \u003ccode class=\"option\"\u003e-r\u003c/code\u003e/\u003ccode class=\"option\"\u003e-R\u003c/code\u003e, \u003ccode class=\"option\"\u003e-s\u003c/code\u003e/\u003ccode class=\"option\"\u003e-S\u003c/code\u003e is not specified on the command line. (This was the default behavior up to PostgreSQL 9.1.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--login\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will be allowed to log in (that is, the user name can be used as the initial session user identifier). This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-L\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-login\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not be allowed to log in. (A role without login privilege is still useful as a means of managing database permissions.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-m \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--with-member=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies an existing role that will be automatically added as a member of the new role. Multiple existing roles can be specified by writing multiple \u003ccode class=\"option\"\u003e-m\u003c/code\u003e switches.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--pwprompt\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIf given, \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e will issue a prompt for the password of the new user. This is not necessary if you do not plan on using password authentication.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-r\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--createrole\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will be allowed to create, alter, drop, comment on, change the security label for other roles; that is, this user will have \u003ccode class=\"literal\"\u003eCREATEROLE\u003c/code\u003e privilege. See \u003ca class=\"xref\" href=\"/docs/18/role-attributes.html#ROLE-CREATION\"\u003erole creation\u003c/a\u003e for more details about what capabilities are conferred by this privilege.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-R\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-createrole\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not be allowed to create new roles. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--superuser\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will be a superuser.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-superuser\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not be a superuser. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v \u003cem class=\"replaceable\"\u003e\u003ccode\u003etimestamp\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--valid-until=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etimestamp\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSet a date and time after which the role's password is no longer valid. The default is to set no password expiry date.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--bypassrls\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will bypass every row-level security (RLS) policy.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-bypassrls\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not bypass row-level security (RLS) policies. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--replication\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will have the \u003ccode class=\"literal\"\u003eREPLICATION\u003c/code\u003e privilege, which is described more fully in the documentation for \u003ca class=\"xref\" href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE ROLE\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-replication\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe new user will not have the \u003ccode class=\"literal\"\u003eREPLICATION\u003c/code\u003e privilege, which is described more fully in the documentation for \u003ca class=\"xref\" href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE ROLE\u003c/span\u003e\u003c/a\u003e. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e also accepts the following command-line arguments for connection parameters:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as (not the user name to create).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e 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.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e to prompt for a password (for connecting to the server, not for the password of the new user).\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan class=\"application\"\u003ecreateuser\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.5.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.5.8\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003eIn case of difficulty, see \u003ca class=\"xref\" href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE ROLE\u003c/span\u003e\u003c/a\u003e and \u003ca class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e front-end library will apply.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.5.9\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo create a user \u003ccode class=\"literal\"\u003ejoe\u003c/code\u003e on the default database server:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ecreateuser joe\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo create a user \u003ccode class=\"literal\"\u003ejoe\u003c/code\u003e on the default database server with prompting for some additional attributes:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ecreateuser --interactive joe\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eShall the new role be a superuser? (y/n) \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eShall the new role be allowed to create databases? (y/n) \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eShall the new role be allowed to create more new roles? (y/n) \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo create the same user \u003ccode class=\"literal\"\u003ejoe\u003c/code\u003e using the server on host \u003ccode class=\"literal\"\u003eeden\u003c/code\u003e, port 5000, with attributes explicitly specified, taking a look at the underlying command:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ecreateuser -h eden -p 5000 -S -D -R -e joe\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eCREATE ROLE joe NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\u003c/code\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo create the user \u003ccode class=\"literal\"\u003ejoe\u003c/code\u003e as a superuser, and assign a password immediately:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ecreateuser -P -s -e joe\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eEnter password for new role: \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003exyzzy\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eEnter it again: \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003exyzzy\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eCREATE ROLE joe PASSWORD 'SCRAM-SHA-256$4096:44560wPMLfjqiAzyPDZ/eQ==$4CA054rZlSFEq8Z3FEhToBTa2X6KnWFxFkPwIbKoDe0=:L/nbSZRCjp6RhOhKK56GoR1zibCCSePKshCJ9lnl3yw=' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN NOREPLICATION NOBYPASSRLS;\u003c/code\u003e\n\u003c/pre\u003e\n\u003cp\u003eIn the above example, the new password isn't actually echoed when typed, but we show what was typed for clarity. As you see, the password is encrypted before it is sent to the client.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.5.10\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/app-dropuser.html\" title=\"dropuser\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003edropuser\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/sql-createrole.html\" title=\"CREATE ROLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE ROLE\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-CREATEROLE-SELF-GRANT\"\u003ecreaterole_self_grant\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","related":[],"sections":[],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-a role --with-admin= role","url":"/docs/18/app-createuser.html"},"summary":"Specifies an existing role that will be automatically added as a member of the new role with admin option, giving it the right to grant membership in the new role to others. Multiple existing roles can be specified by writing multiple -a switches."},{"signature":{"text":"-c number --connection-limit= number","url":"/docs/18/app-createuser.html"},"summary":"Set a maximum number of connections for the new user. The default is to set no limit."},{"signature":{"text":"-d --createdb","url":"/docs/18/app-createuser.html"},"summary":"The new user will be allowed to create databases."},{"signature":{"text":"-D --no-createdb","url":"/docs/18/app-createuser.html"},"summary":"The new user will not be allowed to create databases. This is the default."},{"signature":{"text":"-e --echo","url":"/docs/18/app-createuser.html"},"summary":"Echo the commands that createuser generates and sends to the server."},{"signature":{"text":"-E --encrypted","url":"/docs/18/app-createuser.html"},"summary":"This option is obsolete but still accepted for backward compatibility."},{"signature":{"text":"-g role --member-of= role --role= role (deprecated)","url":"/docs/18/app-createuser.html"},"summary":"Specifies the new role should be automatically added as a member of the specified existing role. Multiple existing roles can be specified by writing multiple -g switches."},{"signature":{"text":"-i --inherit","url":"/docs/18/app-createuser.html"},"summary":"The new role will automatically inherit privileges of roles it is a member of. This is the default."},{"signature":{"text":"-I --no-inherit","url":"/docs/18/app-createuser.html"},"summary":"The new role will not automatically inherit privileges of roles it is a member of."},{"signature":{"text":"--interactive","url":"/docs/18/app-createuser.html"},"summary":"Prompt for the user name if none is specified on the command line, and also prompt for whichever of the options -d / -D , -r / -R , -s / -S is not specified on the command line. (This was the default behavior up to PostgreSQL 9.1.)"},{"signature":{"text":"-l --login","url":"/docs/18/app-createuser.html"},"summary":"The new user will be allowed to log in (that is, the user name can be used as the initial session user identifier). This is the default."},{"signature":{"text":"-L --no-login","url":"/docs/18/app-createuser.html"},"summary":"The new user will not be allowed to log in. (A role without login privilege is still useful as a means of managing database permissions.)"},{"signature":{"text":"-m role --with-member= role","url":"/docs/18/app-createuser.html"},"summary":"Specifies an existing role that will be automatically added as a member of the new role. Multiple existing roles can be specified by writing multiple -m switches."},{"signature":{"text":"-P --pwprompt","url":"/docs/18/app-createuser.html"},"summary":"If given, createuser will issue a prompt for the password of the new user. This is not necessary if you do not plan on using password authentication."},{"signature":{"text":"-r --createrole","url":"/docs/18/app-createuser.html"},"summary":"The new user will be allowed to create, alter, drop, comment on, change the security label for other roles; that is, this user will have CREATEROLE privilege. See role creation for more details about what capabilities are conferred by this privilege."},{"signature":{"text":"-R --no-createrole","url":"/docs/18/app-createuser.html"},"summary":"The new user will not be allowed to create new roles. This is the default."},{"signature":{"text":"-s --superuser","url":"/docs/18/app-createuser.html"},"summary":"The new user will be a superuser."},{"signature":{"text":"-S --no-superuser","url":"/docs/18/app-createuser.html"},"summary":"The new user will not be a superuser. This is the default."},{"signature":{"text":"-v timestamp --valid-until= timestamp","url":"/docs/18/app-createuser.html"},"summary":"Set a date and time after which the role's password is no longer valid. The default is to set no password expiry date."},{"signature":{"text":"-V --version","url":"/docs/18/app-createuser.html"},"summary":"Print the createuser version and exit."},{"signature":{"text":"--bypassrls","url":"/docs/18/app-createuser.html"},"summary":"The new user will bypass every row-level security (RLS) policy."},{"signature":{"text":"--no-bypassrls","url":"/docs/18/app-createuser.html"},"summary":"The new user will not bypass row-level security (RLS) policies. This is the default."},{"signature":{"text":"--replication","url":"/docs/18/app-createuser.html"},"summary":"The new user will have the REPLICATION privilege, which is described more fully in the documentation for CREATE ROLE ."},{"signature":{"text":"--no-replication","url":"/docs/18/app-createuser.html"},"summary":"The new user will not have the REPLICATION privilege, which is described more fully in the documentation for CREATE ROLE . This is the default."},{"signature":{"text":"-? --help","url":"/docs/18/app-createuser.html"},"summary":"Show help about createuser command line arguments, and exit."},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-createuser.html"},"summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-createuser.html"},"summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-createuser.html"},"summary":"User name to connect as (not the user name to create)."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-createuser.html"},"summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .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."},{"signature":{"text":"-W --password","url":"/docs/18/app-createuser.html"},"summary":"Force createuser to prompt for a password (for connecting to the server, not for the password of the new user)."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"Default connection parameters","name":"PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"title":"Environment variables"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
