删除了 Postgresql 服务器中的默认 postgres 数据库

问题描述

我不知道数据库做了什么,我删除了它,却没有意识到现在我将无法再次运行 psql。我如何让 thngs 再次恢复正常?

解决方法

postgres 数据库并不是真正需要的。

但是您可以使用以下方法重新创建它:

psql -U postgres -d template1
psql (13.1)

postgres=# create database postgres;

-d template1 告诉 psql 连接到 template1 数据库。