报错

Data page checksums are disabled.

initdb: error: directory "/var/lib/postgresql/data/pgdata" exists but is not empty
initdb: hint: If you want to create a new database system, either remove or empty the directory "/var/lib/postgresql/data/pgdata" or run initdb with an argument other than "/var/lib/postgresql/data/pgdata".
mkdir: can't create directory '/var/lib/postgresql/data/pgdata': Operation not permitted
mkdir: can't create directory '/var/lib/postgresql/data/pgdata': Operation not permitted
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

思路

提升这个路径是有数据 /var/lib/postgresql/data/pgdata 才导致了失败,那么查看这个路径,提升没有此路径,猜测是docker容器绑定的路径,在Bind mounts里即可找到对应的真实路径,
找了半天在这里在这里插入图片描述

解决

删掉真实路径下的内容即可

Logo

码道开发者社区,聚焦华为云码道 CodeArts 代码智能体,沉淀 Agent、Skill、鸿蒙开发实战内容,供开发者查阅资料、交流技术、分享工程实践

更多推荐