3

I'm trying to set up postgresql to run locally on my windows machine. I've downloaded psql from postgresql.org and installed it. However, whenever I try to run the psql command from the command line it prompts me for a password that I never gave it for a user it seems to have automatically generated based on the user name of my computer.

In Powershell:

PS C:\Users\Theophilus> psql
Password: 
psql: FATAL:  password authentication failed for user "Theophilus"

Nothing I would use as a password works in this case. I've uninstalled and reinstalled postgres from my windows machine to see if maybe there was somewhere to input a password but I found nothing.

Additionally, running psql with the default username of 'postgres' results in the same problem.

PS C:\Users\Theophilus> psql -U postgres
Password for user postgres: 
psql: FATAL:  password authentication failed for user "postgres"

Hopefully someone can help me.

1
  • you need to add a user for psql who you can log in with, try using the gui. Commented Jun 29, 2015 at 21:22

1 Answer 1

6

That's because you're not providing a username in the command so it's using your current username that you're logged in as which doesn't have permission. You should use the postgres account.

 c:\path\to\psql.exe -U postgres

So in your case

PS C:\Users\Theophilus> psql -U postgres

https://wiki.postgresql.org/wiki/First_steps

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

2 Comments

Running the command the way you suggest results in: Password for user postgres: which is again something I don't know
@judgegrubb You set that password during installation. If you've lost/forgotten it, you'll need to reset the password for the postgres user in the database; search for "postgresql password reset windows" to find instructions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.