【发布时间】:2018-03-29 20:13:09
【问题描述】:
我的问题最初是我无法使用 PostgreSQL,因为我不知道密码——我也没有做过密码。我试图重置或恢复密码,并在尝试执行此操作时遵循了各种建议。
起初我尝试编辑 pg_hba.conf 文件,我使用以下命令找到该文件:
sudo vim /etc/postgresql/9.3/main/pg_hba.conf
但这只是把我带到一个空白屏幕,除了关闭窗口我什么都做不了。
有人告诉我试试:
sudo nano /etc/postgresql/9.3/main/pg_hba.conf
...这更好,因为它在页面底部包含了键盘命令,但是文件是空白的,因此无法编辑。
回到这个之后,我想会导致一些错误,如果我现在回到它,我会得到这个:
E325: ATTENTION
Found a swap file by the name "/var/tmp/pg_hba.conf.swp"
owned by: root dated: Tue Oct 17 15:57:30 2017
file name: /etc/postgresql/9.3/main/pg_hba.conf
modified: YES
user name: root host name: Roberts-MacBook-Pro.local
process ID: 2668
While opening file "/etc/postgresql/9.3/main/pg_hba.conf"
(1) Another program may be editing the same file. If this is the case,
be careful not to end up with two different instances of the same
file when making changes. Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r
/etc/postgresql/9.3/main/pg_hba.conf"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file
"/var/tmp/pg_hba.conf.swp"
to avoid this message.
Swap file "/var/tmp/pg_hba.conf.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit,
(A)bort:
我尝试通过键入 D 来删除 .swp 文件,但这似乎没有任何作用。
我真的对这一切感到困惑,我真的不知道如何才能了解更多信息以了解我在做什么。当我访问 PostgreSQL 网站时,我阅读了 pp_hba.conf 文件的外观,但我访问该文件的唯一方法是它完全是空的。
我不知道从哪里开始,所以我非常感谢任何可以为我指明正确方向的人的建议,谢谢。
【问题讨论】:
-
谢谢,但我已经经历了这个阶段。我应该提到这一点。
-
你还在使用 PostgreSQL 9.3 吗?你是如何安装它的?如果 Mac OS 上的配置位于
/etc中,我会感到惊讶。 -
哦,我真傻 - 是的,应该是:Library/PostgreSQL/9.6/data/pg_hba.conf
-
但它仍然让我在 vim 中看到相同的错误消息(如上)
标签: postgresql