initdb: 루트로 실행할 수 없습니다

initdb: 루트로 실행할 수 없습니다

CentOS의 PostgSQL에서 데이터베이스 클러스터를 생성하고 싶습니다.

"initdb" 명령을 입력하면 결과는 다음과 같습니다.

[root@cll agensgraph]# initdb

initdb: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process.

답변1

PostgreSQL 데이터베이스는 실제로 데이터베이스 프로세스를 실행하는 사용자로 초기화가 필요합니다. 이 사용자는 그렇지 않습니다.postgres그러나 유사하거나 유사한 시스템 사용자 계정 postgresql.

CentOS에서는 다음과 같이PostgreSQL Wiki의 지침, 루트로서 다음 중 하나를 수행할 수 있습니다.

service postgresql-9.6 initdb

또는

/usr/pgsql-9.6/bin/postgresql96-setup initdb

(PostgreSQL 9.6을 설정한다고 가정).

다른 웹사이트 제안

sudo postgresql-setup initdb

귀하의 컴퓨터에 있는 PostgreSQL 패키지에 문서가 함께 제공되는 경우(꼭 있어야 함), 이 문서는 데이터베이스 버전을 초기화하는 방법을 정확하게 설명합니다.

답변2

[root@cll ~]# sudo chown jessica:jessica /usr/local/agdata/
[root@cll ~]# cd /usr/local/
[root@cll local]# ll

total 8
drwxr-xr-x.  2 jessica jessica    6 Feb 26 18:06 agdata
drwxr-xr-x.  6 root    root      56 Feb 26 03:31 agensgraph
drwxr-xr-x.  2 root    root    4096 Feb 24 21:01 bin
drwxr-xr-x.  2 root    root       6 Nov  5  2016 etc
drwxr-xr-x.  2 root    root       6 Nov  5  2016 games
drwxr-xr-x.  4 root    root     160 Feb 24 21:01 include
drwxr-xr-x.  6 root    root    4096 Feb 24 21:01 lib
drwxr-xr-x.  2 root    root       6 Nov  5  2016 lib64
drwxr-xr-x.  2 root    root       6 Nov  5  2016 libexec
drwxr-xr-x.  2 root    root       6 Nov  5  2016 sbin
drwxr-xr-x. 13 root    root     169 Feb 24 21:01 share
drwxr-xr-x.  2 root    root       6 Nov  5  2016 src

[root@cll local]# cd agdata/
[root@cll agdata]# initdb
initdb: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.

[root@cll agdata]# su -l jessica
Last login: Mon Feb 26 23:31:29 CST 2018 from 192.168.109.1 on pts/2
[jessica@cll ~]$ cd /usr/local/agensgraph/
[jessica@cll agensgraph]$ initdb
The files belonging to this database system will be owned by user "jessica".
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.
fixing permissions on existing directory /usr/local/agdata ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    ag_ctl -D /usr/local/agdata -l logfile start

[jessica@cll agensgraph]$ 

설명하다

여기에 링크 설명을 입력하세요

관련 정보