DROPUSER(1)
๐
DROPUSER(1) โ the dropuser page, bestie edition
okay so quick vibe check: this is the dropuser manual page from the PostgreSQL 18.6 Documentation, and I'm about to make it make sense. no cap. ๐
โจ NAME โจ
dropuser โ remove a PostgreSQL user account. that's it, that's the whole job. iconic honestly ๐ซถ
๐ธ SYNOPSIS ๐ธ
dropuser [connection-option...] [option...] [username]
๐ฆ DESCRIPTION ๐ฆ
so dropuser removes an existing PostgreSQL user. lowkey straightforward, but there's โจlayersโจ:
- Superusers can use this command to remove any role. like, any. full main character energy.
- otherwise, only non-superuser roles can be removed, and only by a user who possesses the
CREATEROLEprivilege and has been grantedADMIN OPTIONon the target role. yes, both. the audacity honestly ๐ญ
and here's the tea: dropuser is literally just 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. same result, different font. periodt ๐
๐ฅ 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. so like, no name + no-i= it's just gonna be sad and confused, bestie.-e,--echoโ Echo the commands thatdropusergenerates and sends to the server. she's showing her work ๐ โจ-i,--interactiveโ Prompt for confirmation before actually removing the user, and prompt for the user name if none is specified on the command line. the "are you SURE sure" option, we stan a cautious queen.-V,--versionโ Print thedropuserversion and exit. slay, brief.--if-existsโ Do not throw an error if the user does not exist. A notice is issued in this case. no drama, just a lil heads up ๐ธ-?,--helpโ Show help aboutdropusercommand line arguments, and exit.
๐ connection-parameter options ๐
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. so like, slash = unix socket dir, otherwise = hostname. iykyk ๐ง-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). โ ๏ธ this one trips people up EVERY time, read it twice bestie.-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. the "nobody's home to type the password" option, fr fr.-W,--passwordโ Forcedropuserto 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. it's giving "just tell me upfront instead of making me guess" ๐
๐ ENVIRONMENT ๐
PGHOSTPGPORTPGUSER
Default connection parameters. the lil trio ๐
PG_COLORโ Specifies whether to use color in diagnostic messages. Possible values arealways,autoandnever. yes queen, customize your error messages โจ
This utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see Section 32.15). so many env vars, so little time.
๐ DIAGNOSTICS ๐
In case of difficulty, see DROP ROLE (DROP_ROLE(7)) and psql(1) 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.
bestie if it's not working: is the server even up? like actually. check that first ๐
๐ 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 joe
Role "joe" will be permanently removed.
Are you sure? (y/n) y
DROP ROLE joe;
not the "permanently" in all caps energy, the drama is warranted honestly ๐ญ๐
โญ SEE ALSO โญ
createuser(1)DROP ROLE(DROP_ROLE(7))
the whole "make a user / yeet a user" cinematic universe ๐ซถ
and that's the page!! this was brought to you by PostgreSQL 18.6, dated 2026, and yeah the utility is literally called DROPUSER(1) โ the header knew it, the footer knew it, now you know it too. mwah ๐๐
๐ฆ where this page comes from
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms