Postgresql Ubuntu中独立模式的Postgres可执行文件
不久前,我按照说明在Ubuntu 16.10上安装了Postgres 9.5 我需要在独立模式下运行Postgres,以实现数据库真空。我需要运行以下命令:Postgresql Ubuntu中独立模式的Postgres可执行文件,postgresql,Postgresql,不久前,我按照说明在Ubuntu 16.10上安装了Postgres 9.5 我需要在独立模式下运行Postgres,以实现数据库真空。我需要运行以下命令: postgres --single -D /full/path/to/datadir postgres 但是postgres命令不可用: $ postgres No command 'postgres' found, did you mean: Command 'postgrey' from package 'postgrey' (un
postgres --single -D /full/path/to/datadir postgres
但是postgres
命令不可用:
$ postgres
No command 'postgres' found, did you mean:
Command 'postgrey' from package 'postgrey' (universe)
postgres: command not found
它在postgres
用户路径中不可用:
dbuser@pgserver:~$ sudo -i
root@pgserver:~# su postgres
postgres@pgserver:/root$ postgres
No command 'postgres' found, did you mean:
Command 'postgrey' from package 'postgrey' (universe)
postgres: command not found
此实用程序在哪里,或者需要安装什么才能访问它?命令(以及
pg_ctl
和其他命令)位于/usr/lib/postgresql/9.5/bin
中
值得注意的是,它们必须由非特权用户运行,如postgres
。以下是我为解决我的问题所做的:
$ sudo -i
$ mkdir /home/postgres
$ chown postgres:postgres /home/postgres
$ usermod -d /home/postgres/ postgres
$ su - postgres
$ vim ~/.bash_profile
附加:
PATH=$PATH:/usr/lib/postgresql/9.5/bin
export PATH
su-postgres
访问命令:
$ postgres --single -D /full/path/to/datadir postgres
PostgreSQL stand-alone backend 9.5.7
backend>