macos – Postgres – FATAL: database files are incompatible with server

macos – 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

update: this should work for upgrading to postgres 14 as well.

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 youll need to rake db:setup and rake db:migrate from your Rails app to get setup again.

macos – Postgres – FATAL: database files are incompatible with server

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.

Related posts

Leave a Reply

Your email address will not be published. Required fields are marked *