简体   繁体   English

如何在 Mac 上设置/重置 PostgreSQL 的密码?

[英]How to set/reset password for PostgreSQL on Mac?

I'm trying to set up PostgreSQL on Mac, and having some difficulty figuring out my password.我正在尝试在 Mac 上设置 PostgreSQL,但在弄清楚我的密码时遇到了一些困难。 I used homebrew to install with brew install postgresql , which appears to have executed correctly.我使用 homebrew 安装brew install postgresql ,它似乎已正确执行。 When I try to start postgreSQL with psql postgres I am prompted to enter the password for my user account.当我尝试使用psql postgres启动 postgreSQL 时,系统会提示我输入用户帐户的密码。 I never actually set up a password, and my general user account password fails the password authentication.我从来没有真正设置过密码,而且我的普通用户帐户密码无法通过密码验证。 Same with sudo psql postgres .sudo psql postgres相同。

I checked to see if I could change the pg_hba.conf file, but the file either doesn't exist or is not located at /var/lib/postgres/data/pg_hba.conf .我检查了是否可以更改pg_hba.conf文件,但该文件不存在或不位于/var/lib/postgres/data/pg_hba.conf Any thoughts on how to reset my password?关于如何重置我的密码的任何想法?

In Homebrew 2.5.7 the installation of postgresql is at /usr/local/Cellar/postgresql and the configuration file is at /usr/local/var/postgres/pg_hba.conf.在 Homebrew 2.5.7 中,postgresql 的安装位于 /usr/local/Cellar/postgresql,配置文件位于 /usr/local/var/postgres/pg_hba.conf。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM