Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Postgres CentOS and Amazon Linux initdb error: Data directory is not empty! [FAILED]

If completely wiping & reinstalling a Postgres DB, when running initdb like:

service postgresql-9.2 initdb -E 'UTF8' --pgdata="/foo/bar/"

you can encounter this service error:

Data directory is not empty! [FAILED]

To fix it (and this is the nuclear option -- all db data is wiped!)

On Amazon Linux (2014-x):

rm -rf /var/lib/pgsql9/data

On CentOS (6.x)

rm -rf /var/lib/pgsql/9.2/data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.