2

I'm trying to set up PostgreSQL on Mac, and having some difficulty figuring out my password. I used homebrew to install with brew install postgresql, which appears to have executed correctly. When I try to start postgreSQL with psql postgres I am prompted to enter the password for my user account. I never actually set up a password, and my general user account password fails the password authentication. Same with 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. Any thoughts on how to reset my password?

Louie Quicksell
  • 161
  • 1
  • 3
  • 10
  • Does this answer your question? [How to change PostgreSQL user password?](https://stackoverflow.com/questions/12720967/how-to-change-postgresql-user-password) – Crepi Oct 30 '19 at 19:37
  • You may be connecting to your macs pre-installed version of postgresql, which you'll need to sudo/su to in order to connect to. – Joe Love Oct 30 '19 at 21:44

2 Answers2

2

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.

0

In Homebrew 4.1.5 the config file is in

/opt/homebrew/var/postgresql@<version>
Martin M
  • 8,430
  • 2
  • 35
  • 53