[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(为什么?)
重新安装完全没有帮助。我该如何解决?