1DROPUSER(1) PostgreSQL 12.2 Documentation DROPUSER(1)
2
3
4
6 dropuser - remove a PostgreSQL user account
7
9 dropuser [connection-option...] [option...] [username]
10
12 dropuser removes an existing PostgreSQL user. Only superusers and users
13 with the CREATEROLE privilege can remove PostgreSQL users. (To remove a
14 superuser, you must yourself be a superuser.)
15
16 dropuser is a wrapper around the SQL command DROP ROLE (DROP_ROLE(7)).
17 There is no effective difference between dropping users via this
18 utility and via other methods for accessing the server.
19
21 dropuser accepts the following command-line arguments:
22
23 username
24 Specifies the name of the PostgreSQL user to be removed. You will
25 be prompted for a name if none is specified on the command line and
26 the -i/--interactive option is used.
27
28 -e
29 --echo
30 Echo the commands that dropuser generates and sends to the server.
31
32 -i
33 --interactive
34 Prompt for confirmation before actually removing the user, and
35 prompt for the user name if none is specified on the command line.
36
37 -V
38 --version
39 Print the dropuser version and exit.
40
41 --if-exists
42 Do not throw an error if the user does not exist. A notice is
43 issued in this case.
44
45 -?
46 --help
47 Show help about dropuser command line arguments, and exit.
48
49 dropuser also accepts the following command-line arguments for
50 connection parameters:
51
52 -h host
53 --host=host
54 Specifies the host name of the machine on which the server is
55 running. If the value begins with a slash, it is used as the
56 directory for the Unix domain socket.
57
58 -p port
59 --port=port
60 Specifies the TCP port or local Unix domain socket file extension
61 on which the server is listening for connections.
62
63 -U username
64 --username=username
65 User name to connect as (not the user name to drop).
66
67 -w
68 --no-password
69 Never issue a password prompt. If the server requires password
70 authentication and a password is not available by other means such
71 as a .pgpass file, the connection attempt will fail. This option
72 can be useful in batch jobs and scripts where no user is present to
73 enter a password.
74
75 -W
76 --password
77 Force dropuser to prompt for a password before connecting to a
78 database.
79
80 This option is never essential, since dropuser will automatically
81 prompt for a password if the server demands password
82 authentication. However, dropuser will waste a connection attempt
83 finding out that the server wants a password. In some cases it is
84 worth typing -W to avoid the extra connection attempt.
85
87 PGHOST
88 PGPORT
89 PGUSER
90 Default connection parameters
91
92 PG_COLOR
93 Specifies whether to use color in diagnostics messages. Possible
94 values are always, auto, never.
95
96 This utility, like most other PostgreSQL utilities, also uses the
97 environment variables supported by libpq (see Section 33.14).
98
100 In case of difficulty, see DROP ROLE (DROP_ROLE(7)) and psql(1) for
101 discussions of potential problems and error messages. The database
102 server must be running at the targeted host. Also, any default
103 connection settings and environment variables used by the libpq
104 front-end library will apply.
105
107 To remove user joe from the default database server:
108
109 $ dropuser joe
110
111 To remove user joe using the server on host eden, port 5000, with
112 verification and a peek at the underlying command:
113
114 $ dropuser -p 5000 -h eden -i -e joe
115 Role "joe" will be permanently removed.
116 Are you sure? (y/n) y
117 DROP ROLE joe;
118
120 createuser(1), DROP ROLE (DROP_ROLE(7))
121
122
123
124PostgreSQL 12.2 2020 DROPUSER(1)