Linux command
dropuser 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Drop a user
dropuser [username]
Drop with confirmation
dropuser -i [username]
Drop on remote
dropuser -h [hostname] [username]
Drop as specific
dropuser -U [admin_user] [username]
Drop if exists
dropuser --if-exists [username]
说明
dropuser removes a PostgreSQL user (role). It's a command-line wrapper around the DROP ROLE SQL statement, simplifying user management without requiring psql. The role being dropped must not own any databases or have dependencies. Objects owned by the role should be reassigned or dropped before removing the user. Only superusers and roles with CREATEROLE privilege can drop other roles.
参数
- -h, --host _HOST_
- Server hostname.
- -p, --port _PORT_
- Server port.
- -U, --username _USER_
- Connect as this user.
- -i, --interactive
- Prompt for confirmation.
- --if-exists
- Don't error if user doesn't exist.
- -e, --echo
- Show SQL command executed.
- --help
- Display help information.
FAQ
What is the dropuser command used for?
dropuser removes a PostgreSQL user (role). It's a command-line wrapper around the DROP ROLE SQL statement, simplifying user management without requiring psql. The role being dropped must not own any databases or have dependencies. Objects owned by the role should be reassigned or dropped before removing the user. Only superusers and roles with CREATEROLE privilege can drop other roles.
How do I run a basic dropuser example?
Run `dropuser [username]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -h, --host _HOST_ do in dropuser?
Server hostname.