I'm trying to reset my lost password for Postgres v9.1 (windows 7) like written at https://wiki.postgresql.org/wiki/FAQ#I_lost_the_database_password._What_can_I_do_to_recover_it.3F :

1. edit pg_hba.conf to allow trust authorization temporarily

In pg_hba.conf I've put :

local all all trust

host all all trust

2. Reload the config file (pg_ctl reload)

Done. I have also restarted the Postgres service (via services.msc)

3. Connect and issue ALTER ROLE / PASSWORD to set the new password

Then I execute 'psql.exe' but it asks me for a password !

Why ? Thanks for your help.

closed as off-topic by Evan Carroll, dezso, Max Vernon, RLF, Colin 't Hart Mar 13 '17 at 12:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – dezso, Max Vernon, RLF
If this question can be reworded to fit the rules in the help center, please edit the question.

  • You put the new pg_hba.conf entries at the end, so the other ones take priority. Put them at the start. – Craig Ringer Nov 13 '15 at 2:21
  • The entries are already at the beginning of the file – Jeremy Nov 13 '15 at 18:12
  • Are you sure you edited the right pg_hba.conf file? or connecting to the right PostgreSQL instance? – dezso Dec 16 '15 at 10:04

Try to run psql -h (...)

When you use the -h that will tell psql to use a TCP/IP connection ('h' is from host), and the parameter after -h is the name of the host.

In that case is a default address, meaning localhost.

If you don't use the -h (with host next to this parameters) it will use a "local way" of connection called unix domain sockets.

  • 1
    The OP is on Windows, so there is no socket, unfortunately. – dezso Dec 16 '15 at 10:02
  • Using -h and -u helps me to resolve this issue, thanks. – Jeremy Dec 21 '15 at 9:27
  • I'm confused though because his question shows he had host all all trust that should be triggering with -h and as @dezso said, mswin doesn't have sockets. – Evan Carroll Mar 9 '17 at 20:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.