postgresql 什么是 postgres 超级用户

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44903348/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 02:35:47  来源:igfitidea点击:

What is a postgres superuser

sqlpostgresql

提问by Binyamin

I couldn't find the answer in the docs, what exactly is a superuser in postgres?

我在文档中找不到答案,postgres 中的超级用户究竟是什么?

Does the superuser have all privileges? Is it per database? Per instance?

超级用户是否拥有所有权限?是每个数据库吗?每个实例?

采纳答案by Vao Tsun

https://www.postgresql.org/docs/current/static/sql-createrole.html

https://www.postgresql.org/docs/current/static/sql-createrole.html

These clauses determine whether the new role is a "superuser", who can override all access restrictions within the database.

这些子句确定新角色是否是“超级用户”,他可以覆盖数据库中的所有访问限制。

yes - all privileges in all databases on the specified cluster

yes - 指定集群上所有数据库的所有权限

回答by Laurenz Albe

A superuser in PostgreSQL is a user who bypasses all permission checks.

PostgreSQL 中的超级用户是绕过所有权限检查的用户。

Superusers can run commands that can destabilize or crash the database server (e.g., create C functions) and access the operating system.

超级用户可以运行可以破坏数据库服务器的稳定性或崩溃的命令(例如,创建 C 函数)并访问操作系统。

回答by 1ac0

Superuser is per database. From manual:

超级用户是每个数据库。从手册

SUPERUSER NOSUPERUSER These clauses determine whether the new role is a "superuser", who can override all access restrictions within the database. Superuser status is dangerous and should be used only when really needed. You must yourself be a superuser to create a new superuser. If not specified, NOSUPERUSER is the default.

SUPERUSER NOSUPERUSER These clauses determine whether the new role is a "superuser", who can override all access restrictions within the database. Superuser status is dangerous and should be used only when really needed. You must yourself be a superuser to create a new superuser. If not specified, NOSUPERUSER is the default.

The superuser role bypasses all permission checks.

超级用户角色绕过所有权限检查。

The term "cluster" in PostgreSQL is a historical and it is un-related to the PostgreSQL command CLUSTER, which is about organizing tables - you set user per-database, not per-cluster. A cluster is created when PostgreSQL is installed. The installation will usually do initdb- it will create a new cluster with one database in for you. Cluster is justdata dir with databases inside. For location of that data dir look into manual.

PostgreSQL 中的术语“集群”是历史性的,它与 PostgreSQL 命令无关CLUSTER,后者是关于组织表的 - 您为每个数据库设置用户,而不是每个集群。安装 PostgreSQL 时会创建一个集群。安装通常会进行initdb- 它会为您创建一个包含一个数据库的新集群。集群只是里面有数据库的数据目录。有关该数据目录的位置,请查看手册