What are some commands to list your user accounts on postgresql?
There are createuser
& dropuser
commands.
createuser - define a new PostgreSQL user account
dropuser - remove a PostgreSQL user account
Is there a way to list user accounts?
These two commands do not require the user to invoke psql
nor understand details of using it.
Best Answer
Use the psql
shell and.
\deu[+] [PATTERN]
such as.
postgres=# \deu+
List of user mappings
Server | User name | FDW Options
--------+-----------+-------------
(0 rows)
And for all users.
postgres=# \du
List of roles
Role name | Attributes | Member of
------------+------------------------------------------------+-----------
chpert.net | | {}
postgres | Superuser, Create role, Create DB, Replication | {}
Also such as mysql, you can do .
$ psql -c "\du"
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
chpert | | {}
postgres | Superuser, Create role, Create DB, Replication | {}
test | | {}