Can't run postgres on my system. It's showing `postgres is not in the sudoers file. This incident will be reported.` [closed]
Asked Answered
P

1

10

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:

reference

Playmate answered 3/7, 2020 at 3:11 Comment(0)
G
18

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
Guilford answered 3/7, 2020 at 3:51 Comment(3)
The proper mechanism on Debian-based distros is sudo adduser yourself sudoers but of course if you aren't in sudoers you can't sudo anything.Cabinetmaker
Thanks! It worked... Also the postgres cluster status was down. After adding postgres to the sudoers file I've restarted postgres by using this. #format is pg_ctlcluster <version> <cluster> <action> sudo pg_ctlcluster 9.6 main start #restart PostgreSQL service sudo service postgresql restartPlaymate
Glad I could be of help :)Guilford

© 2022 - 2024 — McMap. All rights reserved.