Have you encountered this problem?
createuser: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?
If so, don’t panic.
I tried YouTube, ChatGPT.
The best answer is: reinstall + install
*Yes, that simple. *
- check for versions:
dpkg -l | grep postgresql
postgresql 14
postgresql 16
- remove, reinstall
*[in my case I reinstalled both, even 14 didn’t install at all and THAT was the problem, the 14 version]
Syntax:
sudo apt-get remove –purge postgresql- # delete
sudo apt-get install postgresql- # install
How I did it:
sudo apt-get remove –purge postgresql-16
sudo apt-get install postgresql-16
+++ for you: changing root password
sudo -u postgres psql
ALTER USER postgres WITH PASSWORD ‘new_password’;
q
Enjoy!
Mr Grey
Tried YouTube, reddit, etc.
Alex Grise is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.