close

[Solved] The data directory was initialized by PostgreSQL version 13 which is not compatible with this version 14.0

Hello Guys, How are you all? Hope You all Are Fine. Today I am not able to access my database I am facing following error in my error log The data directory was initialized by PostgreSQL version 13 which is not compatible with this version 14.0 in docker. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How The data directory was initialized by PostgreSQL version 13 which is not compatible with this version 14.0 Error Occurs ?

Today I am not able to access my database I am facing following error in my error log.

2021-10-08  [1] FATAL:  database files are incompatible with server
2021-10-08  [1] 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 Solve The data directory was initialized by PostgreSQL version 13 which is not compatible with this version 14.0 Error ?

  1. How To Solve The data directory was initialized by PostgreSQL version 13 which is not compatible with this version 14.0 Error ?

    To Solve The data directory was initialized by PostgreSQL version 13 which is not compatible with this version 14.0 Error First of all you need to Remove the postgres image Then just Remove the volume Now Pull the image again Here is command that you can use.

  2. The data directory was initialized by PostgreSQL version 13 which is not compatible with this version 14.0

    To Solve The data directory was initialized by PostgreSQL version 13 which is not compatible with this version 14.0 Error First of all you need to Remove the postgres image Then just Remove the volume Now Pull the image again Here is command that you can use.

Solution 1: Pull the image again

  1. First of all you need to Remove the postgres image
  2. Then just Remove the volume
  3. Now Pull the image again

Here is command that you can use.

  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 

Solution 2: Downgrade PostgreSQL version 13

Just downgrade PostgreSQL to version 13

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution Sfor you?

Also, Read

Leave a Comment