I am trying to install postgresql on my MacBook using brew. I ran the command
brew install postgres
and when the download is finished I start the service using
brew services restart postgresql
This works fine, the problem arrises when I either want to log in to psql by running psql
in the command line or when I want to create a database using
createdb
My problem is that psql asks me for a password to my user which I haven't created. The username is the same as the one for my computer so my first thought was that the password would be the same but alas it was not.
Here is the error I get after answering the password incorrectly a couple of times
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: password authentication failed for user "<MyUsername>"
I have switched out my actual username for <MyUsername>
but you get the point
I have scoured the web for answers to this. Here are the things that I have tried:
- The password to my computer (several hundreds of times, just to be sure)
- The default password postgres (supposedly just
postgres
) - The empty password
- Logging into the postgres (
psql -U postgres
) user and trying the same passwords. - Going into the pg_hba.conf file to change the database administrative login
- Uninstalling and Reinstalling a couple of times
- Bashing my head against the wall (really mad this one didn't work)
Hopefully I'm being completely blind and the default password is something obvious