Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法在Redhat linux 7中启动postgresql服务_Postgresql_Rhel - Fatal编程技术网

无法在Redhat linux 7中启动postgresql服务

无法在Redhat linux 7中启动postgresql服务,postgresql,rhel,Postgresql,Rhel,我已经在Redhat 7服务器上安装了postgresql 9.4。它是通过postgresql-9.4.3-1-linux-x64.run安装的。它显示了一条清晰的消息“postgres已安装在您的机器上”。现在当我以 su - postgres 它不要求输入密码,而是进入bash提示符。如果我键入psql,则显示“未找到命令”。当我尝试通过root用户启动服务时 service postgresql initdb 我得到: 服务命令仅支持基本LSB操作(启动、停止、重新启动、尝试重新启动

我已经在Redhat 7服务器上安装了postgresql 9.4。它是通过postgresql-9.4.3-1-linux-x64.run安装的。它显示了一条清晰的消息“postgres已安装在您的机器上”。现在当我以

su - postgres
它不要求输入密码,而是进入bash提示符。如果我键入psql,则显示“未找到命令”。当我尝试通过root用户启动服务时

service postgresql initdb
我得到:

服务命令仅支持基本LSB操作(启动、停止、重新启动、尝试重新启动、重新加载、强制重新加载、状态)。对于其他操作,请尝试使用systemctl


我尝试了
start postgrestart
,但没有成功。我试着搜索,但什么也没找到。我知道它是通过启动服务来实现的。

服务postgresql initdb

是用于创建新数据库群集的独立命令

initdb——创建一个新的PostgreSQL数据库集群

initdb[option…][-pgdata|-D]目录

您必须独立使用它,但不能将其用作
service
命令的参数。阅读有关如何使用此命令的文档:

使用
service postgresql start
启动postgresql服务,使用
service postgresql stop
停止它

psql:“未找到命令”


尝试使用
su postgres
命令(不带破折号)切换到
postgres
用户。它会影响
$PATH
环境变量。如果这无助于使用完整路径来指定命令,例如
/usr/bin/psql

在ubuntu部分发布此问题。
initdb
不会“启动”postgres,要启动服务,您需要使用
start