Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

migrated from Feb 6 '12 at 18:19

This question came from our site for professional and enthusiast programmers.

If you didn't use /usr/local/pgsql/data for your data, where did you store it? Unless you used a RAM drive, it's still there. You can store the data anywhere, no problem at all. – Frank Heikens Feb 6 '12 at 6:26
Which operating system and which version? How did you install Postgres (a package or from source, which version)? Is this a first restart after installing Postgres? Did you try to upgrade? Did all partitions mount successfully? Your description is so vague it is impossible to help you - maybe you should get some professional support. – Tometzky Feb 6 '12 at 9:43
@FrankHeikens i didn't explicitly specify where to put the data. I installed postgresql via yum on centoS, added a postgres user and a database and everything was cool until the restart. looks like my data is in /var/lib/pgsql/data so i should be okay. – zach Feb 6 '12 at 16:54
up vote 1 down vote accepted

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/...)

share|improve this answer
than you Eelke. Looks like postgres installed in /var/lib/pgsql/data/ I installed Postgresql from YUM on CentOS 5.4 (EPEL package repo) and would appreciate suggestions on hoe to automatically start postgres. – zach Feb 6 '12 at 17:08
hm. try: "chkconfig postgresql on" – swasheck Feb 6 '12 at 19:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.