pg_ctl: cannot be run as root

症状
使用pg_ctl管理数据库报错:

当然如果设置了环境变量

PGDATA=/d/pgsql/data

启动

pg_ctl start

启动报错

[root@db1 root~]# pg_ctl start

pg_ctl: cannot be run as root

Please log in (using, e.g., "su") as the (unprivileged) user that will

own the server process.

问题原因
用户错误的使用了root用户来执行命令。

--切换到操作系统数据库管理员用户下运行命令

解决方案

 [root@db1 root~]# su - highgo

 [highgo@db1 ~]$ pg_ctl start

停止

pg_ctl stop

--查看启动数据库进程

ps -ef|grep post

 

 


原文链接:https://blog.csdn.net/pg_hgdb/article/details/80453739

posted @ 2022-09-27 18:11  徐徐图之  阅读(1699)  评论(0编辑  收藏  举报