PostgreSQL weird error: could not connect to the database template1: could not connect to the server: there is no such file or directory

I need to create a database. First I run: sudo su - postgres Then: createdb test And I keep getting this error: createdb: could not connect to database template1: 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" This is stupid, I never encountered problems with psql, but this time I do not understand what is wrong ... And there is no external server, I am connected locally . Please help. I am running on ubuntu.

+7
postgresql ubuntu psql
source share
1 answer

The error message suggests:

The server is running locally

and according to the result ps -ef | grep "post" ps -ef | grep "post" posted in comments, the answer is final No , server processes do not exist, server is not working.

The fact that you are writing I never encountered psql problems suggests that it has been installed and works before then, in this case, look at the most recent log file inside /var/log/postgresql to check for any fatal message about an error indicating why the server did not start.

+3
source share

All Articles