Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to create the database and I am a newbie.

When I install PostgreSQL, I gave this command

sudo yum install postgresql postgresql-server

and later I modified the config file

sudo vim /var/lib/pgsql/data/pg_hba.conf

and modified as

local   all         all                               trust
host    all         all          trust
host    all         all         ::1/128               trust
host    all         all             md5

While I am trying to startup the postgresql service

sudo service postgresql initdb

> Data directory is not empty!                               [FAILED]

sudo chkconfig postgresql on

sudo service postgresql start

Starting postgresql service:                               [  OK  ]

i am getting the comment like this.

please help me in this.

Thanks in advance..


share|improve this question

2 Answers 2

up vote 1 down vote accepted

Initdb should only be run once. It will create the directory where you'll keep the config files and (usually) the actual database. You've obviously already done that already; otherwrise there wouldn't be any pg_hba.conf for you to edit.

So, just don't run postgresql initdb again, unless you are doing a complete reinstall.

share|improve this answer
thanks for the reply.. i run it twice... you mean the its not the problem in installation.. –  sridhar May 8 '13 at 8:36
I mean that there is no problem with your installation, at least not any that you've shown. The only thing that is failing is doing initdb more than once, and that should fail - everything else shows as OK. If there's any other problem, it would help if you could describe it. –  Jenny D May 8 '13 at 8:39
Thank you very much.. then its not a problem.. if i face a problem i will let you know.. –  sridhar May 8 '13 at 8:47
once again thank you –  sridhar May 8 '13 at 8:47
Hello Jenny, I am facing problem during executing the run. Actually i installed software which connected with the database. while i am running the software i am getting error as "OperationalError: (OperationalError) FATAL: Ident authentication failed for user "galaxy"" i am new to the postgres database if you could help me in reinstalling the database.. (which delets the previous data stored in the particular user or complete reinstallation).. Thanks in advance.. –  sridhar May 22 '13 at 10:32

I had the same issue, using PostgreSQL 9.3 on CentOS 6.

I deleted the /var/lib/pgsql/9.3/data folder, then re-ran the command

sudo service postgresql-9.3 initdb

... which successfully initialised the db service again.

share|improve this answer

Your Answer


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

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