0

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?

3
  • Why are you using -W option of psql here when you have a password associated to the user kleber ? Commented Jun 6, 2016 at 14:47
  • with ou without it, i am unable to login with that user. Commented Jun 6, 2016 at 14:51
  • -W asks psql to not to prompt for the password. If you want to use it use with pgpass file (postgresql.org/docs/9.4/static/libpq-pgpass.html) Commented Jun 6, 2016 at 14:55

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.