. Advertisement .
. Advertisement .
The error “The data directory was initialized by PostgreSQL version 13 which is not compatible with this version 14.0” is one of the most common errors. This error occurs when you attempt to connect to the PostgreSQL database but the server is running PostgreSQL version 13 and you are running PostgreSQL version 14.0. This blog will provide some solutions to fix the error.
When dose the “The data directory was initialized by PostgreSQL version 13 which is not compatible with this version 14.0″ error happen?
When you have downloaded Portainer onto the server and created a PostgreSQL database in a container there. Then, you could no longer get access to the database. The log shows a message that there is a version problem.
2021-10-08  FATAL: database files are incompatible with server 2021-10-08  DETAIL: The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.0 (Debian 14.0-1.pgdg110+1). PostgreSQL Database directory appears to contain a database; Skipping initialization
How To Fix This error?
Option 1: Pull the image once more
1. First, delete the postgres image.
2. Then simply turn off the volume.
3. Pull the image once more.
You can utilize the following command.
docker kill $(docker ps -q) # stop all containers docker rm $(docker ps -a -q) # remove all containers docker rmi $(docker images -q) # remove all images docker network prune # remove all networks docker volume prune # remove all volumes
Option 2: Downgrade to PostgreSQL version 13
Try downgrading PostgreSQL to version 13 and you’re good to go.
Option 3: Update the data file to the new format
$ brew postgresql-upgrade-database
We hope you enjoyed our blog post on how to solve the bug “The data directory was initialized by PostgreSQL version 13 which is not compatible with this version 14.0”. Please leave a comment if you have any further questions or concerns regarding this topic. Thank you for taking the time to read; we are always delighted anytime one of our pieces can give important information on this topic!