sách gpt4 ăn đã đi

postgresql - 名为 "postgres"的数据库

In lại Tác giả: Walker 123 更新时间:2023-11-29 14:11:06 31 4
mua khóa gpt4 giày nike

我刚刚设置了 Postgres 供我网络上的不同用户使用。每个用户都有自己的用户名/密码/数据库,但是当我连接到 Pg 时,我还可以看到一个“postgres”数据库(甚至可以创建表等)。我试图从公众那里撤销对该数据库的访问,但它不会让我连接。 postgres 数据库到底是什么,为什么需要它?我可以禁用它以便用户只能看到我为他们创建的数据库吗?

câu trả lời hay nhất

运行 initdb 时默认创建 postgres 数据库。

Quote from the manual:

Creating a database cluster consists of creating the directories in which the database data will live (...) creating the template1 and postgres databases. When you later create a new database, everything in the template1 database is copied. (...) The postgres database is a default database meant for use by users, utilities and third party applications.

没有什么特别的,不需要的话可以去掉:

drop database postgres;

当然,您需要以 super 用户身份执行此操作。唯一的缺点是,当您以 postgres 操作系统用户身份运行 psql 时,您需要显式提供要连接的数据库名称

关于postgresql - 名为 "postgres"的数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28261600/

31 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress