Skip to main content

Posts

Showing posts from February, 2013

How to login into postgres without root password?

I am not a postgres guy I hardly know anything about it but when the duty calls you have to do anything to get it working. So today duty called :) where I need to take the dump of a postgres database and import it on another machine now the biggest challenge was logging into the postgres and run the command when you don't know the root user password and the sad thing was I installed that postgres long back but didn't kept the password. Now I have to first find the password (which was not possible) or find a way to access it somehow. Luckily I found one solution to my problem :) . According to the article we can allow any user to do operation without any password, okayyy this was interesting. I tried them and bingo it worked :) So I would like to share those steps here so that it will help some needful like me. Step 1. Stop the postgres. > service postgres stop Step 2. Reset the authentication mechanism (assuming defaults are already being used)