簡體   English   中英

在 Linux 上安裝 PostgreSQL,我遇到錯誤:“-bash: /usr/local/pgsql/bin/initdb: Permission denied”,為什么?

[英]Install PostgreSQL on Linux, I met the error: "-bash: /usr/local/pgsql/bin/initdb: Permission denied", Why?

我的雲操作系統是OpenEuler,就像CentOS。我想安裝postgresql14.2,我這樣做如下:

[root@ecs ~]# dnf -y update
[root@ecs ~]# dnf install -y bc tmux readline-devel zlib zlib-devel tar vim
[root@ecs ~]# groupadd postgres
[root@ecs ~]# useradd -g postgres postgres
[root@ecs ~]# passwd postgres
[root@ecs ~]# wget https://ftp.postgresql.org/pub/source/v14.2/postgresql-14.2.tar.gz
[root@ecs ~]# tar -xzvf postgresql-14.2.tar.gz
[root@ecs ~]# cd postgresql-14.2
[root@ecs ~]# ./configure 
[root@ecs ~]# make 
[root@ecs ~]# make install 
[root@ecs ~]# mkdir /usr/local/pgsql/data 
[root@ecs ~]# chown -R postgres:postgres /usr/local/pgsql/data
[root@ecs ~]# su - postgres
[postgres@ecs ~]$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

當我運行命令時:

/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

我遇到錯誤:

-bash: /usr/local/pgsql/bin/initdb: Permission denied

我不知道如何處理這種錯誤,請給我一些建議。 非常感謝!

我解決了這個麻煩,使用:

chown postgres:postgres /usr/local/pgsql -R

代替

chown -R postgres:postgres /usr/local/pgsql/data

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM