Cannot initiate postgresql on WSL Arch - postgresql

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.

Related

PostgreSQL: could not connect to server

I have an issue that I've been trying to fix but after reading articles, I couldn't do anything about it. The problem is as it follows:
I just installed Apache, php and MySQL on a VPS. Then I had to install PostgreSQL and set up a database and a new user. After running the psql command, I got the following output:
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"?
So, my question is how do I fix this. I'd be grateful if I receive some feedback.

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"

postgreSQL server not loading

I'm trying to install postgreSQL(11) server on my local machine.I have downloaded PgAdmin 4(Mac) from the official website and installed it.
When I open the pgadmin the server is opening on random ports like 55957,55062 etc, not on 5432.
I have edited my "PostgreSQL.conf" and changed the listen address=* and port =5432 ,but I could not able to restart the service.
When I type "sudo service postgreSQL restart" it was showing "Sudo : Service command not found"
Also "Sudo command not found".
I don't have much experience in installing postgreSQL ,Can anyone please let me know what I'm doing wrong and let me know how I can add the server in postgres.
Note: I have opened pgadmin - select add new server - localhost as server name and User and DB as postgres.But when I put 5432 as port it was giving the common error "Whether TCP/ip accepting on 5432" and when I put the port where the pgadmin server is currently running (127.0.0.1:55097) it was getting timed out exception.

Could not connect to server. Postgresql connecting to unix domain socket

My site was running perfectly. I switched off my server to upgrade memory and cores. After turning it on again, i'm greeted by a 500 error. After switching to debug mode, it returns the following:
OperationalError at /
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"?
Request Method: GET
Request URL: http://mysite.nl/
Django Version: 1.6.11
Exception Type: OperationalError
Exception Value:
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"?
Exception Location: /data_nfs/opensurfaces/venv/local/lib/python2.7/site-packages/psycopg2/__init__.py in connect, line 130
Python Executable: /data_nfs/opensurfaces/venv/bin/python
Python Version: 2.7.6
I'm running Ubuntu 14.04, with a django applicaiton hosted by nginx, gunicorn and postgresql. It appears I need to connect the socket to the server? How Can i do this?
A seemingly related question tells me to remove a file, but I don't have this file.
It turns out that sudo service postgresql restart doesn't do the trick. Instead I restart it using sudo -u postgres /etc/init.d/postgresql restart, which does work.

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.