1

I'm on Ubuntu and trying to connect to postgresql by any means, i.e. running psql throws:

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

sudo /etc/init.d/postgresql restart fixes the problem, however, once I restart the computer, I always have to type the line into terminal all over again. Is there any way to fix this problem, so I don't have to type the line?

Vincas Stonys
  • 1,125
  • 14
  • 26
  • take a look here: http://www.postgresql.org/docs/8.2/static/server-start.html – gabrielhilal Jun 30 '15 at 17:36
  • Ah ok, so I never even started the server, and that line I think restarts/starts. `pg_ctl` looks like a helpful tool for that, but how do I find the data path for it if it's not "/usr/local/pgsql/data" as in documentation? – Vincas Stonys Jun 30 '15 at 19:39
  • @gabrielhilal Please don't link to very old versions of the documentation, link to /current/ instead of /8.2/ or whatever – Craig Ringer Jul 01 '15 at 01:42
  • Seems to be the same as http://stackoverflow.com/q/31150514/398670 ... is there a class assignment? :p – Craig Ringer Jul 01 '15 at 01:42

1 Answers1

0

Do you kill the server before restarting the computer? If you're just restarting the computer, or if the battery dies while your server is running, you more than likely will run into this issue.

Tony Gaeta
  • 124
  • 3
  • 11