You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.6 KiB
1.6 KiB
layout | title | author | author_login | author_email | date | tags |
---|---|---|---|---|---|---|
post | psql FATAL: database files are incompatible with server | [{display_name sipp11} {login sipp11} {email sipp11@gmail.com} {url }] | sipp11 | sipp11@gmail.com | Jan 23, 2015 | [postgres error] |
Once in a while you might see this error.
LOG: skipping missing configuration file "/usr/local/var/postgres/postgresql.auto.conf"
FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 9.3, which is not compatible with this version 9.4.0.
Why?
Basically it meant that you somehow upgraded postgresql server. All your data was safe, yet it would never work with new server until you upgraded the data.
Solution
-
Figure out what version both old and new one are. As example above, older is 9.3 and 9.4 for new one.
-
Move your existing data to another directory
$ mv /usr/local/var/postgres /usr/local/var/postgres9351
-
Initial a new database for the new
postgresql
$ initdb /usr/local/var/postgres -E utf8
-
Upgrade the old one to current one with
pg_upgrade
command; for more information you could check out at postgresql docs$ pg_upgrade -b /usr/local/Cellar/postgresql/9.3.5_1/bin -B /usr/local/Cellar/postgresql/9.4.0/bin -d /usr/local/var/postgres9351 -D /usr/local/var/postgres
it was actually simple than it looks with clearer explanation as following:
$ pg_upgrade -b oldbindir -B newbindir -d olddatadir -D newdatadir
-
Start your postgresql server and continue working!