postgres是PostgreSQL的默认默认用户吗? [英] Is postgres a default and special user of PostgreSQL?

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

问题描述


  1. https:// www。 postgresql.org/docs/10/static/default-roles.html 列出了
    个Postgresql的默认角色。但是我找不到用户 postgres
    是在postgresql中默认创建的。 postgres
    的默认角色吗?手册会丢失还是误解?

  2. 在postgresql中, postgres 是特殊用户,还是普通用户仅
    像手动创建的一样? PostgreSQL服务器是否需要用户 postgres ?要删除它会给服务器或其他问题造成麻烦吗?

  3. 以下两个在psql中运行的命令提供了默认角色或
    用户名,都包括 postgres

  1. 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. Is postgres a default role? Does the manual miss it or do I misunderstand?
  2. In postgresql, is postgres a special user, or a regular user just like one created manually? Does the PostgreSQL server need the user postgres? WIll removing it cause some trouble to the server or something else?
  3. 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)


谢谢。

推荐答案


  1. postgres 不是默认角色。

使用 initdb ,您可以使用 -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.

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

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