1DROPUSER(1) PostgreSQL 9.2.24 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, --echo
29 Echo the commands that dropuser generates and sends to the server.
30
31 -i, --interactive
32 Prompt for confirmation before actually removing the user, and
33 prompt for the user name if none is specified on the command line.
34
35 -V, --version
36 Print the dropuser version and exit.
37
38 --if-exists
39 Do not throw an error if the user does not exist. A notice is
40 issued in this case.
41
42 -?, --help
43 Show help about dropuser command line arguments, and exit.
44
45 dropuser also accepts the following command-line arguments for
46 connection parameters:
47
48 -h host, --host=host
49 Specifies the host name of the machine on which the server is
50 running. If the value begins with a slash, it is used as the
51 directory for the Unix domain socket.
52
53 -p port, --port=port
54 Specifies the TCP port or local Unix domain socket file extension
55 on which the server is listening for connections.
56
57 -U username, --username=username
58 User name to connect as (not the user name to drop).
59
60 -w, --no-password
61 Never issue a password prompt. If the server requires password
62 authentication and a password is not available by other means such
63 as a .pgpass file, the connection attempt will fail. This option
64 can be useful in batch jobs and scripts where no user is present to
65 enter a password.
66
67 -W, --password
68 Force dropuser to prompt for a password before connecting to a
69 database.
70
71 This option is never essential, since dropuser will automatically
72 prompt for a password if the server demands password
73 authentication. However, dropuser will waste a connection attempt
74 finding out that the server wants a password. In some cases it is
75 worth typing -W to avoid the extra connection attempt.
76
78 PGHOST, PGPORT, PGUSER
79 Default connection parameters
80
81 This utility, like most other PostgreSQL utilities, also uses the
82 environment variables supported by libpq (see Section 31.14,
83 “Environment Variables”, in the documentation).
84
86 In case of difficulty, see DROP ROLE (DROP_ROLE(7)) and psql(1) for
87 discussions of potential problems and error messages. The database
88 server must be running at the targeted host. Also, any default
89 connection settings and environment variables used by the libpq
90 front-end library will apply.
91
93 To remove user joe from the default database server:
94
95 $ dropuser joe
96
97 To remove user joe using the server on host eden, port 5000, with
98 verification and a peek at the underlying command:
99
100 $ dropuser -p 5000 -h eden -i -e joe
101 Role "joe" will be permanently removed.
102 Are you sure? (y/n) y
103 DROP ROLE joe;
104
106 createuser(1), DROP ROLE (DROP_ROLE(7))
107
108
109
110PostgreSQL 9.2.24 2017-11-06 DROPUSER(1)