PostgreSQL:如何使用Mac OS X查找pg_hba.conf文件 [英] Postgresql: How to find pg_hba.conf file using Mac OS X
问题描述
我在使用postgres时遇到了麻烦。我不记得我的postgres密码,也不知道如何更改密码。我想我应该更改一个月前设置的md5密码设置,但是我不知道如何找到该文件并使用终端打开它。有人可以帮忙吗?
Hi I am having trouble with postgres. I don't remember my postgres password and don't know how to change the password. I'm guessing I should change the md5 password settings I set a month ago, but I don't know how to find the file and open it using my terminal. Can someone help?
推荐答案
我最近了解到的另一种方法是去终端输入:
Another way I learned recently is to go to the terminal and type:
ps aux | grep postgres
显示您的计算机上运行的所有postgres进程。从列表中,您应该看到一个格式为 ... -D ...
的格式。例如:
which shows all the postgres processes running on your machine. From the list you should see one with the format ... -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文件。
the -D means directory. In the terminal, do a sudo su
and then cd to that directory, and you'll find the pg_hba.conf file.
另一种方式:
转到终端并输入:定位pg_hba.conf
。应该会有一些结果。
Go to your terminal and type: locate pg_hba.conf
. There should be a few results.
这篇关于PostgreSQL:如何使用Mac OS X查找pg_hba.conf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!