Postgresql recovery after reboot

postgresql

I installed Postegresql and added a database which I was using as part of a local server. However, I restarted the computer and my Postgresql database seems to be gone. The Postegresql documentation says that the data should be placed in /usr/local/pgsql/data however I did not do this and this directory is empty on my system. Also, I cannot find a postgresql config file so I am not sure where Postgreql may have been putting my databases.

Has this happened to anyone before? If so, is there a way to recover my databases? Fortunately these databases are not so old that there is irrevocable memory loss but i would prefer to recover my data if possible.

If I can't find my data I will need to restart /recreate my data although I would prefer not to. Any suggestions would be greatly appreciated.

thanks,
zach cp

Best Answer

To locate your data try the following command:

sudo find / -name postgresql.conf

The problem probably is that your server isn't automatically started. You can manually start it with a command like:

pg_ctl start -D <your data dir>

If you need help starting it automatically please specify which os/distribution you are running and how you installed postgresql (source/yum/rpm/...)