postgres是PostgreSQL的默认默认用户吗?
- https:// www。 postgresql.org/docs/10/static/default-roles.html 列出了
个Postgresql的默认角色。但是我找不到用户postgres
,
是在postgresql中默认创建的。postgres
是
的默认角色吗?手册会丢失还是误解? - 在postgresql中,
postgres
是特殊用户,还是普通用户仅
像手动创建的一样? PostgreSQL服务器是否需要用户postgres
?要删除它会给服务器或其他问题造成麻烦吗? -
以下两个在psql中运行的命令提供了默认角色或
用户名,都包括postgres
。
- https://www.postgresql.org/docs/10/static/default-roles.html lists
default roles of postgresql. But I don't find user
postgres
there, which has been created by default in postgresql. Ispostgres
a default role? Does the manual miss it or do I misunderstand? - In postgresql, is
postgres
a special user, or a regular user just like one created manually? Does the PostgreSQL server need the userpostgres
? WIll removing it cause some trouble to the server or something else? The following two commands run in psql provide default roles or usernames, which both include
postgres
. why do they differ?
# select usename from pg_catalog.pg_user;
usename
----------
postgres
(1 row)
# select rolname from pg_catalog.pg_roles;
rolname
----------------------
postgres
pg_monitor
pg_read_all_settings
pg_read_all_stats
pg_stat_scan_tables
pg_signal_backend
(6 rows)
谢谢。
-
postgres
不是默认角色。
使用 initdb $ c创建PostgreSQL数据库集群时$ c>,您可以使用
-U
选项指定安装超级用户的名称。如果您省略该选项,则超级用户的名称将与您使用的操作系统用户的名称相同。
When you create the PostgreSQL database cluster with initdb
, you can specify the name of the installation superuser with the -U
option. If you omit that option, the name of the superuser will be the same as the name of the operating system user you are using.
因为习惯上 initdb
由操作系统用户 postgres
运行的PostgreSQL,超级用户通常称为 postgres
也是,但这不是必需的。
Since it is customary to have initdb
PostgreSQL run by an operating system user postgres
, the superuser is usually called postgres
too, but that is in no way required.
postgres
只是普通的超级用户
您将很难删除它,因为它拥有所有系统对象,并且您不能轻易地修改这些对象。建议您不要尝试。
You will have trouble dropping it because it owns all the system objects, and you cannot easily modify those objects. You are advised not to try.
pg_read_all_settings
,其他项不会显示在 pg_user
,因为它们没有登录角色。
pg_read_all_settings
and the others don't show up in pg_user
because they are no login roles.