Deleting Database Users in PostgreSQL

To delete a database user, you use the dropuser command, along with the user’s name, and the user’s access is removed from the default database, like this:

matthew@seymour:~$  dropuser msmithDROP USER

You can also log in to your database by using psql and then use the DROP USER commands. Here is an example:

matthew@seymour:~$ psql demodbWelcome to psql, the PostgreSQL interactive terminal.Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quitdemodb=# DROP USER msmith ;DROP USERdemodb=# \q

Get Ubuntu Unleashed 2015 Edition: Covering 14.10 and 15.04, Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.