Search code examples
postgresqlpsql

Password authentication failed for user


I am having a problem trying to run psql on my MacOs. The psql command returns the following error:

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

How could I fix this?

I try to put my sudo password when the terminal request me the password, but it didn't work. The only password that works is for the default user "postgres" that I set the password when I install the app on my system.

I don't know why the user 'luicruz' was automatically created, I didn't create this user or set a password for this user.

And now I can't use the psql command.

Below is an image showing the login/Group roules of the Pg Admin 4 and also the return of the commands in the terminal

enter image description here


Solution

  • The problem is that the psql command needs to be used in addition to the database name, and I didn't know that. After creating the database, I was able to use the command apart from the psql command.