i can not connect to psql

0

2

i typed psql and it's show this error

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"?

i've tried these commands:


ahls_cuchi@ubuntu-18-04-template-DND:/var/log/postgresql$ service postgresql status
● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
   Active: active (exited) since Wed 2019-07-10 16:22:34 PDT; 18min ago
  Process: 24295 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 24295 (code=exited, status=0/SUCCESS)


ahls_cuchi@ubuntu-18-04-template-DND:/var/log/postgresql$ systemctl status postgresql@10-main.service
● postgresql@10-main.service - PostgreSQL Cluster 10-main
   Loaded: loaded (/lib/systemd/system/postgresql@.service; indirect; vendor preset: enabled)
   Active: failed (Result: protocol) since Wed 2019-07-10 16:22:34 PDT; 18min ago
  Process: 24288 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 10-main start (code=exited, status=1/FAILURE)
 Main PID: 4267 (code=exited, status=0/SUCCESS)

ahls_cuchi@ubuntu-18-04-template-DND:/var/log/postgresql$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
10  main    5432 down   postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log


ahls_cuchi@ubuntu-18-04-template-DND:/var/log/postgresql$ sudo pg_ctlcluster 10 main start
Job for postgresql@10-main.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status postgresql@10-main.service" and "journalctl -xe" for details.

Quân

Posted 2019-07-10T23:44:33.483

Reputation: 1

Answers

0

Ran into this issue and strangely chown -R postgres on /var/ worked, according to this S/O Answer, it's because the rights on /var would've been changed to non-root.

kingraphaii

Posted 2019-07-10T23:44:33.483

Reputation: 101