本文介绍了数据库名为“ postgres”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚设置了Postgres,供网络上的其他用户使用。每个用户都有自己的用户名/密码/数据库,但是当我连接到Pg时,我还可以看到一个 postgres数据库(甚至创建表等)。我试图撤消公开访问该数据库的权限,但之后我无法连接。 postgres数据库到底是什么,为什么需要它?我可以禁用它,以便用户只看到我为他们创建的数据库吗?

I've just set up Postgres for use by different users on my network. Every user has his own username/password/database, but when I connect to Pg I can also see a 'postgres' database (and even create tables etc). I tried to REVOKE access to that database from public but then it won't let me connect. What exactly is the postgres database and why is it needed? Can I disable it so that users only see the database(s) I've created for them?

推荐答案

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

The postgres database is created by default when you run initdb.

没有什么特别的,如果不需要,可以将其删除:

There is nothing special about it, and if you don't need it, you can drop it:

drop database postgres;

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

You need to do that as a superuser of course. The only downside of this is that when you run psql as the postgres operating system user, you need to explicitly provide a database name to connect to

这篇关于数据库名为“ postgres”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 22:12