I'm having trouble starting postgresql-9.4 on Centos 6.
I can't run initdb
because the data directory already exists.
But I can't start the service because the data directory is missing!
[centos@dave-gbp ~]$ sudo service postgresql-9.4 start
/var/lib/pgsql/9.4/data is missing. Use "service postgresql-9.4 initdb" to initialize the cluster first.
[FAILED]
[centos@dave-gbp ~]$ sudo service postgresql-9.4 initdb
Initializing database: mkdir: cannot create directory `/var/lib/pgsql/9.4/data/pg_log': File exists
[FAILED]
Any idea how I can get past this problem?
The solution is very easy for initdb.
Use cd /var/lib/pgsql/9.4/data In Which Two files 1.pg_log, 2.postgresql.conf
remove both using rm -rf .
Then exit from all directory.