I'm trying to install postgres on my WSL Ubuntu. Installation is finished but when I run psql
the following error is displayed.
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.5432"?
And when I run sudo find /var/run/postgresql/.s.PGSQL.5432
to find the file, it's showing another error like this.
postgres is not in the sudoers file. This incident will be reported.
It'll be more clear from the screenshot.
How to continue? Please help...
Screenshot:
This error seems to be because your username, i.e postgres
is not in the sudoers file. Which is why you don't have authority to run the above command for the postgres
user.
Try adding the user by:
Open file
sudo nano /etc/sudoers
Then add the user below admin user like below syntax.
user_name ALL=(ALL) ALL