我的問題原本是我無法使用PostgreSQL,因爲我不知道密碼 - 我也沒有創建過密碼。我正嘗試重置或恢復密碼,並在嘗試執行此操作時遵循了各種建議。無法重置PSQL密碼或編輯mac上的pg_hba.conf文件
起初,我嘗試過編輯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文件應該是什麼樣子,但是我可以訪問這個文件的唯一方式是完全空的。
我不知道該從哪裏出發,所以我會非常感謝任何能指引我正確方向的人的建議,謝謝。
這可能值得一讀https://stackoverflow.com/questions/7975414/how-to-check-status-of-postgresql-server-mac-os-x –
謝謝,但我已經通過這個階段。我應該提到這一點。 – Robert
你甚至使用PostgreSQL 9.3嗎?你是如何安裝它的?如果配置在Mac OS的'/ etc'中,我會感到驚訝。 –