您好我在使用postgres時遇到問題。我不記得我的postgres密碼,也不知道如何更改密碼。我猜我應該更改一個月前設置的md5密碼設置,但我不知道如何找到該文件並使用我的終端打開它。有人可以幫忙嗎?Postgresql:如何使用Mac OS X找到pg_hba.conf文件
回答
另一種方式我最近才知道是去終端類型:
ps aux | grep postgres
這表明所有的機器上運行的Postgres處理。從列表中您應該看到格式爲... -D ...
的格式。 E.G:
root 4155 0.0 0.0 2432908 68 ?? S 6May13 0:00.01 sudo su postgres -c /opt/local/lib/postgresql84/bin/postgres -D /opt/local/var/db/postgresql84/defaultdb -p 5432
的-D意味着目錄。在終端中,執行sudo su
,然後cd到該目錄,您將找到pg_hba.conf文件。
而另一種方式:
轉到您的終端類型:locate pg_hba.conf
。應該有一些結果。
如果可以連接,請使用SHOW hba_file;
。
如果無法連接,則需要找到數據目錄。這將顯示爲啓動PostgreSQL的postgres
或pg_ctl
命令的-D
參數,因此您通常可以通過ps -ef | grep postgres
找到它。
使用EnterpriseDB.com安裝程序安裝Postgres 9.2的Mountain Lion Mac上的示例結果:'/ Library/PostgreSQL/9.2/data/pg_hba.conf'。 –
這是找到它的最佳方法,謝謝! –
- 1. 如何安裝PostgreSQL用於Mac OS X
- 2. 使用URLForDirectory而不是FSFindFolder找到Mac OS X文件夾
- 3. 在Mac OS X上安裝Timescaledb,PostgreSQL 9.6未找到
- 4. 如何使用OpenSSL的在Mac OS X
- 5. 如何在Mac OS X上使用mpi
- 6. 如何使用dylib在Mac OS X(C++)
- 7. 如何使用c執行mac OS x可執行文件iphone
- 8. 如何使用Mac OS X從USB設備讀取文件?
- 9. 如何在mac os x中使用python查找文件夾路徑?
- 10. 的Tesseract:text2image找不到鍵(Mac OS X)
- 11. 的Mac OS X LD:庫找不到-lpython3
- 12. 未找到Eclipse CDT Binary - Mac OS X Lion
- 13. libusb找不到mac os x 10.6.8
- 14. Mac OS X Lion - mysql:命令未找到
- 15. Mac OS X 10.7.5上的NetBeans 7.3.1找不到源文件夾
- 16. pyenchant在Mac OS X上找不到字典文件
- 17. 在Mac OS X上找不到Pip可執行文件
- 18. 在Mac OS X上找不到C頭文件
- 19. 在Mac OS X上找到Git安裝文件夾
- 20. 無法找到終端的文件 - Mac OS X Sierra
- 21. Mac OS X上的Postgresql與ICU補丁
- 22. Mac OS X應用文件權限
- 23. 使用PEAR與MAC OS X
- 24. 如何使用AppleScript在Mac OS X詞典中查找單詞?
- 25. 如何在mac os中添加頭文件到gcc x 10.6
- 26. 我如何在Mac OS X
- 27. 未找到'openssl/evp.h'文件OS x Mongodb
- 28. 尋找適用於Mac OS X的Java二進制文件
- 29. 如何將Mac OS X 10.6.6更新添加到我的Mac OS X 10.6.3中dmg
- 30. 如何刪除文件時,文件名在Mac OS X太長
感謝有用.. [鏈接](http://scratching.psybermonkey.net/2009/06/postgresql-how-to-reset-user-name.html)未來.. –
在最新的Postgres 9.x它將在/ data /目錄中找到 /Library/PostgreSQL/9.4/data/pg_hba.conf – Saad