【发布时间】:2020-04-19 11:08:01
【问题描述】:
我最近开始使用 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".
我认为删除数据中的所有内容是不明智的,所以我创建了一个目录 /home/user/postgres/data。创建此目录后,我将 postgres 设为其用户。
我在运行 initdb 时仍然遇到权限错误。我什至更改了权限以允许读取、写入、执行,但我无法通过权限错误。
帮助?
【问题讨论】:
-
如果您遇到错误,请告诉我们。
标签: postgresql archlinux