Psql: FATAL: password authentication for custom windows 8

I installed postgresql on windows and during the installation asked to make it for the account. This made a new Windows user on my computer named postgres, and I created a password for it.

Now I want to run psql on the Windows command line, it asks for a password (without mentioning the user) and always returns me an error: psql: FATAL: password authentication failed for user "Ash". Despite the fact that I entered the password for my accounts many times.

using pgadmin I changed the user "postgres" to "Ash", but I still have to redo the password. I followed these steps: I forgot the password entered during postgres installation (I rather type host all 127.0.0.1/32 trust , because I am in the windows), but when psql starts again, so that I can change the password, I get an error : psql FATAL:could not load pg_hba.conf. Together.

Why can't it boot? All I did was add an additional authentication option.

Also, is the Windows user separate from the postresql user, or are they the same (dependent on each other)?

Edit:

As you can see, this did not give me a choice if Aisha should be superuser or not. or other options in this regard.

I also used pgadmin ||| to create a new user, but the same error appears: enter image description hereenter image description here

The user does not exist, so why does he do it?

+12
source share
3 answers

createuser is a command line utility. Use CREATE USER username WITH PASSWORD 'fred'; or similar at the SQL level in psql . Pay attention to the semicolon.

What you do in the screenshot starts writing an SQL command starting with createuser , but never sending it to the server to run, because there is no terminator with a comma. Thus, you will never get an error that tells you that it does not make sense.

+11
source

The user on your computer has nothing to do with the user on PostgreSQL. The installer simply creates a PostgreSQL account and role with the same name and password (which, in my opinion, is a bad idea), but they are in no way connected. The Windows user is used to start the server; the PostgreSQL role is used inside the database.

So, you must first access the server using the postgres user, and then create a user for yourself. Do not change the username inside the server or the server on which the user is running! Just create a new username and give it the necessary permissions.

You can use psql -U postgres to connect to the server and request a password.

Check permissions for pg_hba.conf, postgres user must have permissions for him. If you just edited it as an administrator, that should be fine, but if you accepted permissions or something else, it might mess it up.

+14
source

I had exactly the same problem, and this line solved it;

 createuser --createdb -U postgres --login -P 'your_new_user' 

@ sami-kuhmonen was right, but his approach to solving the problem did not help me.

+1
source

All Articles