dropuser
dropuser — remove a PostgreSQL user account
当前阅读 PG 18·选择有来源记录的版本
此版本暂无所选语言的定义,以下显示原始英文内容。
- Documented executable
- dropuser
- Executable version
- 18.6
- Reference inventory
- Client applications
- Option definition groups
- 10
- environment
- map[description:Default connection parameters name:PGHOST PGPORT PGUSER], map[description:Specifies whether to use color in diagnostic messages. Possible values are always , auto and never . name:PG_COLOR]
- manual path
- app-dropuser.html
- signature
- dropuser [ connection-option ...] [ option ...] [ username ]
- synopsis
- dropuser [ connection-option ...] [ option ...] [ username ]
版本定义 PG 18
dropuser
dropuser — remove a PostgreSQL user account
Synopsis
dropuser [connection-option...] [option...] [username]
Description
dropuser removes an existing PostgreSQL user. Superusers can use this command to remove any role; otherwise, only non-superuser roles can be removed, and only by a user who possesses the CREATEROLE privilege and has been granted ADMIN OPTION on the target role.
dropuser is a wrapper around the SQL command DROP ROLE. There is no effective difference between dropping users via this utility and via other methods for accessing the server.
Options
dropuser accepts the following command-line arguments:
username-
Specifies the name of the PostgreSQL user to be removed. You will be prompted for a name if none is specified on the command line and the
-i/--interactiveoption is used. -e--echo-
Echo the commands that dropuser generates and sends to the server.
-i--interactive-
Prompt for confirmation before actually removing the user, and prompt for the user name if none is specified on the command line.
-V--version-
Print the dropuser version and exit.
--if-exists-
Do not throw an error if the user does not exist. A notice is issued in this case.
-?--help-
Show help about dropuser command line arguments, and exit.
dropuser also accepts the following command-line arguments for connection parameters:
-hhost--host=host-
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.
-pport--port=port-
Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.
-Uusername--username=username-
User name to connect as (not the user name to drop).
-w--no-password-
Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a
.pgpassfile, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. -W--password-
Force dropuser to prompt for a password before connecting to a database.
This option is never essential, since dropuser will automatically prompt for a password if the server demands password authentication. However, dropuser will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing
-Wto avoid the extra connection attempt.
Environment
PGHOSTPGPORTPGUSER-
Default connection parameters
PG_COLOR-
Specifies whether to use color in diagnostic messages. Possible values are
always,autoandnever.
This utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see Section 32.15).
Diagnostics
In case of difficulty, see DROP ROLE and psql 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 libpq front-end library will apply.
Examples
To remove user joe from the default database server:
$dropuser joe
To remove user joe using the server on host eden, port 5000, with verification and a peek at the underlying command:
$dropuser -p 5000 -h eden -i -e joeRole "joe" will be permanently removed. Are you sure? (y/n)yDROP ROLE joe;
See Also
createuser, DROP ROLEDocumented options
| Option and arguments | Description |
|---|---|
| -e --echo | Echo the commands that dropuser generates and sends to the server. |
| -i --interactive | Prompt for confirmation before actually removing the user, and prompt for the user name if none is specified on the command line. |
| -V --version | Print the dropuser version and exit. |
| --if-exists | Do not throw an error if the user does not exist. A notice is issued in this case. |
| -? --help | Show help about dropuser command line arguments, and exit. |
| -h host --host= host | 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. |
| -p port --port= port | Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. |
| -U username --username= username | User name to connect as (not the user name to drop). |
| -w --no-password | 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. |
| -W --password | Force dropuser to prompt for a password before connecting to a database. |
Environment variables
| Variable | Meaning |
|---|---|
| PGHOST PGPORT PGUSER | Default connection parameters |
| PG_COLOR | Specifies whether to use color in diagnostic messages. Possible values are always , auto and never . |
比较版本
完整来源事实
options
map[description:Echo the commands that dropuser generates and sends to the server. names:[-e --echo] signature:-e --echo source_url:/docs/18/app-dropuser.html summary:Echo the commands that dropuser generates and sends to the server.], map[description:Prompt for confirmation before actually removing the user, and prompt for the user name if none is specified on the command line. names:[-i --interactive] signature:-i --interactive source_url:/docs/18/app-dropuser.html summary:Prompt for confirmation before actually removing the user, and prompt for the user name if none is specified on the command line.], map[description:Print the dropuser version and exit. names:[-V --version] signature:-V --version source_url:/docs/18/app-dropuser.html summary:Print the dropuser version and exit.], map[description:Do not throw an error if the user does not exist. A notice is issued in this case. names:[--if-exists] signature:--if-exists source_url:/docs/18/app-dropuser.html summary:Do not throw an error if the user does not exist. A notice is issued in this case.], map[description:Show help about dropuser command line arguments, and exit. names:[-? --help] signature:-? --help source_url:/docs/18/app-dropuser.html summary:Show help about dropuser command line arguments, and exit.], map[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-dropuser.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.], map[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-dropuser.html summary:Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.], map[description:User name to connect as (not the user name to drop). names:[-U username --username= username] signature:-U username --username= username source_url:/docs/18/app-dropuser.html summary:User name to connect as (not the user name to drop).], map[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-dropuser.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.], map[description:Force dropuser to prompt for a password before connecting to a database. This option is never essential, since dropuser will automatically prompt for a password if the server demands password authentication. However, dropuser 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-dropuser.html summary:Force dropuser to prompt for a password before connecting to a database.]
来源引用
定义来源
center · PostgreSQL 18 · ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8
正文语言: en · ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8