Unable to start Postgresql on Ubuntu - postgresql

I am using Ubuntu on WSL.
I have been trying to get a postresql server to start but I can't.
When I try to start a service using
service postgresql start, it gives me
11/main (port 5432): down
On top of that even running the psql command gives me :
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"?
Can anyone help me with this? I've looked at a dozen SO questions and it ultimately ends at the same error.

Try out:
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib

Related

Postgresql could not connect to server (Postgresql 12.2, ubuntu 20.04)

I found some other Stack Overflow threads on this, but, after trying a lot of solutions, couldn't fix the problem.
Upon running the command psql -U postgres, I got the following error message.
psql: error: could not connect to server: 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.5433"
Running the command pg_lsclusters gave me this output:
12 main 5433 down <unknown> /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
Any thoughts?
If everything has been correctly installed and setup the following command should work:
sudo pg_ctlcluster 12 main start

could not connect to database postgres

createuser: could not connect to database postgres: 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 am trying to install dspace 6.3 on ubuntu server 18.04 but after installing postgresql when I run the command createuser -U postgres -d -A -P dspace I am getting the above error help please
Did you start the server? Try sudo service postgresql restart or sudo systemctl restart postgresql

Postgresql 9.5 on ubuntu

im try install postgresql on ubuntu using this tutorial
https://www.youtube.com/watch?v=dSqosCc_KLA
And im stop on step when print comand psql 4:54 seconds video
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"?
This is a known issue, I had that too. Try to reinstall postgresql with a version number. Remove your postgres and reinstall it. For example:
sudo apt-get install postgresql-9.5
An other fix would be to create a softlink for example:
ln -s /tmp/pgsql.5432 /var/run/postgresql/pgsql.5432
I would suggest you to reinstall postgresql like I said in point 1.
Note: default port of postgresql is 5432

postgresql: no such file or directory

I'm trying to install a postgresql database on my VPS server by using this guide.
In there it says
sudo apt-get install postgresql postgresql-contrib libpq-dev
And then
sudo su - postgres
createuser --pwprompt
exit
When I run createuser --pwprompt it asks me to create a password, once I fill it in I get the following error:
createuser: could not connect to database postgres: 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"?
If I do psql --version I get psql (PostgreSQL) 9.4beta3
And which psql outputs /usr/bin/psql
Any idea on how to fix this problem?
Update
Running pg_ctl gives another error
WARNING:root:could not open file '/etc/apt/sources.list.d/passenger.list'
The program 'pg_ctl' is currently not installed. To run 'pg_ctl' please ask your administrator to install the package 'postgres-xc'
Althgough reading up on postgres-xc shows quite a lot of other problems.

Postgresql installation

I'm going crazy with postgresql (9.1) installation on my server (debian) i have rent on gandi.net !
I did the aptitude get-install postgresql postgresql-client command.
I'm having this error when trying to execute psql command.
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 been searching on the web. And maybe the servers are not running. I don't know how to check and how to launch them.
My postgres command doesn't work either (command not found).
Any idea?
The database engine is not running.
service postgresql start
or
/etc/init.d/postgresql start
to start the engine. I don't remember though if debian initializes the data dir automatically.