Postgresql installation - postgresql

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.

Related

PostgresSQL is not getting connected

I am new to Ubuntu operating system and trying to install postgresSQL in my system.
After completing the installation and entering postgres mode when I enter the command pgsql, it gives me this error
psql: error: 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"?
what could possibly be wrong??
Probably the postgresql server is not running; you can run netstat -adp to see if postgres is listening on port 5432.
If it isn't, then it most likely isn't running; systemctl status postgresql will help identify if it is even installed, and if it has run into any issues (for further details, see https://mydbanotebook.org/post/troubleshooting-01/)
If it is running and seems healthy, then it might not be configured to accept connections in whichever way you are connecting (which user, database, host/network etc) - see details about the pg_hba.conf file that includes rules for this - https://www.postgresql.org/docs/9.1/auth-pg-hba-conf.html
After install, you must create an instance with initdb.
Later, change the listen_address to *, restart the service and now you can check the port.
Check the pg log for the message: "postgres is ready to accept connections"

Cannot initiate postgresql on WSL Arch

I'm slowly losing my mind. I tried to install postgresql on WSL Arch but I can't connect to it. The error I'm getting when I try to run 'psql' is:
psql: error: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/run/postgresql/.s.PGSQL.5432"?
Like the error says, there's no 'run' folder. I don't know how to configure it if I can.
I'm using WSL2. I tried stopping/starting with systemctl. It is running but can't connect.

Unable to start Postgresql on Ubuntu

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

Postgres service started, but can't connect. Nothing listening on port 5432

I don't know how this happened, but my postgres server (9.6.2) has stopped working locally. I seem to be able to start it up, and stop it using:
brew services start postgresql and brew services start postgresql but when I try to connect using psql I get 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 "/tmp/.s.PGSQL.5432"?
When I try to see if anything is listening on port 5432 using lsof -i :5432 I get nothing.
Looked at other posts that say check the pg_hba.conf file, which I did, but doesn't seem to be the problem.
I ended up reinstalling postgres via homebrew. That by itself didn't do enough. I had to kill my data directory to get this to work (i.e. rm -rf /path/to/my/data/directory) and then rebuild it using initdb.
This solution obviously only works if you don't care about keeping your data (in my case, it was just data for my dev environment, so I didn't). If you do want to save a copy of your data, I you'd have to come up with something else.

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