[Ubuntu 16.04] 我安装了postgresql 9.5以及依赖项:
sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-common
sudo apt-get install postgresql-9.5 libpq-dev
当我想运行psql
时,我得到:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
但是/var/run/postgresql/
是空的。当我重新启动posgresql时,一切似乎都很好:
$ /etc/init.d/postgresql restart
[ ok ] Restarting postgresql (via systemctl): postgresql.service.
$ /etc/init.d/postgresql status
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since wto 2016-09-27 16:18:26 CEST; 1min 15s ago
Process: 3076 ExecReload=/bin/true (code=exited, status=0/SUCCESS)
Process: 3523 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 3523 (code=exited, status=0/SUCCESS)
但如果检查ps aux
没有这样的PID(为什么??)
完全重新安装并没有任何帮助。我该如何解决?
编辑:
我刚注意到然后键入/etc/init.d/postgresql force-reload
postgresql,systemctl有一段时间,然后被自动杀死
除了systemctl返回
postgresql.service loaded active exited PostgreSQL RDBMS
● postgresql@9.5-main.service loaded failed failed PostgreSQL Cluster 9.5-main
为什么会失败?