Skip to content

Instantly share code, notes, and snippets.

@kennwhite
Last active May 18, 2023 12:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kennwhite/2a3227165b14eca73b99 to your computer and use it in GitHub Desktop.
Save kennwhite/2a3227165b14eca73b99 to your computer and use it in GitHub Desktop.
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
@Emerson-Gabriel
Copy link

Thank you for putting up with my problem after a day of work suffering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment