1

所以,

我的管理员在 centos7 机器上安装(不知道如何)postgresql 9.2(64 位版本)。问题是我需要初始化数据库,所以我应该运行类似的东西:

service postgresql-9.2 initdb

但我得到错误:

The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.

做了一些搜索,人们说你应该通过直接调用一些脚本来初始化,但是这个 CentOS 7 机器中并不存在每个给定的位置。

例如这个位置(是的,它适用于 9.3,我使用 9.2,但类似的位置无论如何都不存在):

/usr/lib/pgsql-9.3/bin/postgresql93-setup initdb

或这个

/usr/pgsql-9.3/bin/postgresql93-setup initdb

我发现

/usr/lib64/pgsql 

但是这个目录只有一堆'*.so'文件。

我到底如何在 centos7 上为 postgresql 9.2 运行 initdb?

4

2 回答 2

1

您可以直接从 postgres 帐户运行它

#su - postgres -c pg_ctl initdb
于 2014-09-26T12:39:01.633 回答
0

刚刚在 Centos 上安装了 Postgresql 9.3。

#cd /etc/init.d
#ls postgres*

并且有一个 posgresql-9.3 脚本

#./postgresql-9.3 

为您提供运行选项,其中之一是 initdb

于 2014-09-03T19:30:56.643 回答