psql: FATAL: password authentication failed for user windows 8 psql: FATAL: password authentication failed for user windows 8 postgresql postgresql

psql: FATAL: password authentication failed for user windows 8


The user on your machine has nothing to do with the user on PostgreSQL. The installer just creates an account and a PostgreSQL role with the same name and password (which in my mind is a bad idea), but they're not related in any way. The Windows user is used to run the server, the PostgreSQL role is used inside the database.

So you should first access the server with the user postgres and then create a user for yourself. Don't change the username inside the server, or the server's running user! Just create a new username and grant it the permissions you need.

You can use psql -U postgres to connect to the server and it'll ask for the password.

Check the permissions for pg_hba.conf, the postgres user must have permissions for it. If you only edited it as an admin, it should be ok, but if you took permissions or anything else, it may mess it up.


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

What you're doing in your screenshot is starting to write an SQL command beginning with createuser, but never sending it to the server to run because there's no semicolon terminator. So you never get the error that would tell you it doesn't make sense to do that.


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 of solving the problem did not work for me.