PostgreSQL用户列表 [英] PostgreSQL user listing

查看:787
本文介绍了PostgreSQL用户列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取psql中某个数据库的用户列表-例如 template0。谁是用户?还是对于 template1数据库:-那里的用户是谁?



已经尝试过:

  \du +-未列出数据库,而不是用户
从 pg_users中选择*; -没有列出数据库


解决方案

用户实际上不是,用于数据库,它们用于集群,并被赋予访问数据库的不同权限。要列出用户 \du 应该可以,但是您需要连接。

  psql template1 -c'\du'


应该在命令行提示符下执行。 (或在连接到数据库时,从psql提示符 \du )。


I want to get a list of users for a certain database in psql - for example "template0". Who are the users? Or for "template1" database: - who are the users there?

Already tried:

\du+  -- no database is Listed not Users
Select * from "pg_users";  -- no database is listed

解决方案

User aren't actually, "for the database", they're for cluster and are given different permissions to access databases. To list users \du should do, but you need to be connected. Something like

psql template1 -c '\du'

from the command line prompt should do. (or \du from psql prompt when you are connected to the database).

这篇关于PostgreSQL用户列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆