Kleber Mota
Kleber Mota

Reputation: 9065

Failed to connect to postgresql database with new created user

After create a new user in my postgresql server with this commands:

#su postgres
CREATE ROLE kleber WITH LOGIN;
ALTER ROLE kleber WITH PASSWORD '...';

i try login with this user with this command:

# psql -U kleber -W

but I get this error:

psql: FATAL:  Peer authentication failed for user "kleber"

what i am missing here?

Upvotes: 0

Views: 64

Answers (1)

avichalp
avichalp

Reputation: 1120

You should try: psql -h <hostname> -d <database name> -U <user>

On executing this command you will be prompted to enter the password for your user, kleber in this case. Enter the password for user kleber and this should work.

Upvotes: 1

Related Questions