Tuesday, April 30, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 7391  / 3 Years ago, thu, october 7, 2021, 10:14:03

I'm trying to set up a PostgreSQL server using the instructions found on here. I installed the package via apt-get install postgresql and now I'm on the step:



sudo -u postgres psql postgres



which gives the 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'm guessing the server isn't running but I'm not sure how to start it. Any tips would be much appreciated.



UPDATE: Running service postgresql status doesn't output anything, even after sudo service postgresql start.



UPDATE #2: Running ps auxw | grep post doesn't turn up anything either, so I'm guessing the server daemon isn't running.


More From » postgresql

 Answers
7

Check what database clusters are currently created:



pg_lsclusters


If there is one, but it's not running, then start it (substituting the version and name):



sudo pg_ctlcluster x.y name start


If there isn't one, create one and have it started:



sudo pg_createcluster --start x.y name


Normally, this should have happened automatically when you install the package. So either something happened during package installation, or the package was already installed and someone had already messed around with the things I show above.


[#28019] Thursday, October 7, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
urvedcaly

Total Points: 171
Total Questions: 118
Total Answers: 124

Location: Cape Verde
Member since Fri, Nov 27, 2020
4 Years ago
urvedcaly questions
Tue, Nov 8, 22, 19:40, 2 Years ago
Fri, May 26, 23, 15:27, 1 Year ago
Wed, Jan 19, 22, 08:09, 2 Years ago
Thu, May 13, 21, 03:34, 3 Years ago
;