postgresql - 如何运行“postgres”命令(单用户)
问题描述
我已经postgres
安装在 ubuntu 机器上,我可以通过以下方式进入命令行:
$ sudo -u postgres psql
psql (10.15 (Ubuntu 10.15-0ubuntu0.18.04.1))
Type "help" for help.
postgres=#
我可以通过执行以下操作来启动/停止服务器:
$ sudo service postgresql
Usage: /etc/init.d/postgresql {start|stop|restart|reload|force-reload|status} [version ..]
这两个看起来都不错。但是,我想在单用户模式下运行 postgres 来做几个测试。在postgres
页面上,它提供了一些示例,例如:
要启动单用户模式服务器,请使用类似的命令
postgres --single -D /usr/local/pgsql/data other-options my_database
但是,如果我使用“postgres”命令,我只会收到一条错误消息,说我没有该命令:
$ postgres
Command 'postgres' not found, did you mean:
为了进入单用户模式,我需要安装什么来运行“postgres”命令?
解决方案
它已经安装,只是不在您的 PATH 中,因为预计您不会手动使用它。
它可能在“/usr/lib/postgresql/10/bin/postgres”之类的地方,或者您可以使用locate
或find
找到它。
推荐阅读
- python - 从 windguru 刮桌子
- python - 如何在 matplotlib 的箱线图中删除自定义标签下的数字 x 刻度?
- java - 无法测试宁静的服务
- azure - 在开发 .NET 核心 Azure 功能时脱机使用 Azure 密钥库机密
- css - 为范围旋钮 ionic-range 添加边框颜色
- java - DDD - java 9 模块项目组织
- python - 将 Datetime 列转换为仅在 Python 中的 DataFrame 中显示日期
- c# - 如何检查每个 Json 对象的某个键是否具有特定值?
- java - InvocationTargetException 有问题
- sql - 如何将 CTE 与动态查询枢轴一起使用?