Some of you MAY be able to crack a really tough nut...

I have to move all the data from a PostgreSQL (9.1 - Windows) database to SQL Server because the company I am contracting with is upgrading the old program with a newer .NET version.

The real nut is that the User/Password for Postgres are baked in the old program... Of course the guy who wrote it is gone. No source code or any way to contact him. (Smaaaart)

I was able to obtain the WHOLE Postgres directory (Bin, Data... The whole thing) and I hope it can be done.

Is there a way out of this mess, or should I just blow the contract and look for something else?


  • What does 'baked' mean? It's hardcoded and then compiled into a binary? How does the lost password issue affect the migration?
    – dezso
    Mar 3, 2015 at 7:53
  • Correct. User and Password are hardcoded in a compiled program, and the company doesn't have any documentation. Problem is that I'm not all that familiar with Postgres, and I have no clue about how to recover the data, if at all possible. Looks like Postgres definitely wants User/Pass to let me do anything with the data... You think I should just walk away? Mar 3, 2015 at 8:49
  • If you have access to the server, read into dba.stackexchange.com/questions/19643/…
    – dezso
    Mar 3, 2015 at 9:36

1 Answer 1


I think currently you are not able to log into the postgresql database? If this is the case you can get access of the database by changing the access authorization. Please open pg_hba.conf and change the following line:

local   all             postgres                                md5


local   all             postgres                                peer


local   all             postgres                                trust

Now restart the postgresql service. You should now be able to connect to the database by typing: psql

You can get list of databases by typing: psql -l

  • 1
    I'd love to vote up your answer (Changing md5 to trust in pg_hba was perfect), but it requires 15 points of reputation... :-) Thank you, though, besides the fact that I'm a complete noob with Postgres, your answer was exactly to the point. Mar 20, 2015 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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