0

I am using Windows 10 and have just installed PostgreSQL 10.4. Now my superuser is postgres and I have to create a new user. I used the following command on cmd :-

psql -U postgres -c "CREATE ROLE gautam LOGIN NOSUPERUSER INHERIT CREATEDB CREATEROLE;" mydb

and the error is

C:\Users\Gautam Jajoo>psql -U postgres psql: FATAL: password authentication failed for user "postgres" password retrieved from file "C:\Users\Gautam Jajoo\AppData\Roaming/postgresql/pgpass.conf"

Can anyone tell the possible solution for it !!

1 Answers1

0

Add the -W parameter to be prompted for password

psql -U postgres -c -W "CREATE ROLE gautam LOGIN NOSUPERUSER INHERIT CREATEDB CREATEROLE;" 

and you can use http://cmder.net to have cmd in windows

calm
  • 363
  • 2
  • 9
  • 1
    Added -W parameter also, not working. result is same – Gautam Jajoo May 30 '18 at 14:40
  • download cmder run it and do sudo then run: "su postgres" then run: "psql" that will log you in as postgres – calm May 30 '18 at 14:40
  • I have done the same. It is asking for password and I entered the password but getting the error psql: `FATAL: password authentication failed for user "postgres " ` – Gautam Jajoo May 30 '18 at 15:22
  • it seems to me that the user has a white space at the end – calm May 30 '18 at 15:25
  • check this post https://stackoverflow.com/questions/7695962/postgresql-password-authentication-failed-for-user-postgres – calm May 30 '18 at 15:27