Postgres - FATAL: database files are incompatible with server Postgres - FATAL: database files are incompatible with server postgresql postgresql

Postgres - FATAL: database files are incompatible with server


If you recently upgraded to 11 or 12 from 10.x you can run the below command to upgrade your postgres data directory retaining all data:

brew postgresql-upgrade-database

The above command is taken from the output of brew info postgres


If you are looking for the nuclear option (delete all data and get a fresh database), you can do:

rm -rf /usr/local/var/postgres && initdb /usr/local/var/postgres -E utf8

and then you'll need to rake db:setup and rake db:migrate from your Rails app to get setup again.


Try this : https://gist.github.com/joho/3735740

It worked perfectly for me.In the end it also generates you 2 bash scripts to check your DB and remove the old cluster.Really Awesome.

see: http://www.postgresql.org/docs/9.2/static/pgupgrade.html to understand more.