varlibpostgresdata存在但不是空的。

问题描述 投票:-1回答:1

我最近开始使用arch。(arch版本5.6.4)。

我通过运行postgresql来安装。

sudo pacman -S postgresql

我按照archwiki的指南来初始化数据库集群 我通过运行以下命令切换到postgres用户

sudo -iu postgres

之后,我运行。

initdb -D /var/lib/postgres/data

我得到了下面的输出。

[postgres@archlinux ~]$ initdb -D /var/lib/postgres/data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

initdb: error: directory "/var/lib/postgres/data" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/postgres/data" or run initdb
with an argument other than "/var/lib/postgres/data".

我认为删除数据中的所有内容是不明智的 所以我创建了一个目录 homeuserpostgresdata. 创建这个目录后,我把postgres设为它的用户。

当运行initdb时,我仍然得到一个权限错误。我甚至改变了权限,允许读,写,执行,但我不能通过权限错误。

請問有什麼幫助嗎?

postgresql archlinux
1个回答
0
投票

我自己修复了它。只要删除postgresdata中的所有内容,然后运行initdb。

© www.soinside.com 2019 - 2024. All rights reserved.