0

I'm new to PostgreSQL. I just installed the Postgres.app on my Mac and wanted to use the psql command in the terminal. However, when I type psql in the terminal, I'm asked to input the password. I was never asked to set a password during installation so I'm confused what the password is. I've looked at other similar questions but none of them worked for my case.

$ psql
$ Password for user kaili:
$ psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: 
FATAL:  password authentication failed for user "kaili"

Could anyone give me some hints on how to access the database as the user kaili? Thank you!

Kai Li
  • 55
  • 1
  • 7
  • I see you are logging in as kaili. Did you set a password when you created this user? – Tyler Liu Jan 31 '22 at 02:58
  • 2
    You have to choose an existing database user. Look at the thousands of other questions like that. – Laurenz Albe Jan 31 '22 at 04:42
  • Is `kaili` the system user you installed `postgres.app` as? What happens of you do `psql -h localhost`? Do you have another install or have you installed another Postgres in the past? Can you find the file `pg_hba.conf` and post the uncommented parts? Add the these answers as update to your question. – Adrian Klaver Jan 31 '22 at 16:04
  • @LaurenzAlbe, `kaili` should be an existing user per [postgres.app](https://postgresapp.com/) and assuming it is the system user it was installed as. – Adrian Klaver Jan 31 '22 at 16:06

0 Answers0