postgresql错误处理

psql: 无法联接到服务器: 没有那个文件或目录
服务器是否在本地运行并且在 Unix 域套接字
"/var/run/postgresql/.s.PGSQL.5432"上准备接受联接?

ubuntu@dongyang-K46CB:/$ sudo service postgresql start
Failed to start postgresql.service: Unit postgresql.service is masked.
ubuntu@dongyang-K46CB:/$ sudo systemctl unmask postgresql
Removed symlink /etc/systemd/system/postgresql.service.

ubuntu@dongyang-K46CB:/$ sudo systemctl restart postgresql
ubuntu@dongyang-K46CB:/$ sudo service postgresql start
ubuntu@dongyang-K46CB:/$ service postgresql status
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since 三 2017-04-05 23:40:24 CST; 20s ago
Process: 9895 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 9895 (code=exited, status=0/SUCCESS)

4月 05 23:40:24 dongyang-K46CB systemd[1]: Starting PostgreSQL RDBMS...
4月 05 23:40:24 dongyang-K46CB systemd[1]: Started PostgreSQL RDBMS.
4月 05 23:40:37 dongyang-K46CB systemd[1]: Started PostgreSQL RDBMS.

原文地址:https://www.cnblogs.com/cdyboke/p/6671284.html