0

I'm trying to install GeoDjango for my website. To do that, I first need to create a PostgreSQL database. Following this tutorial, I'm trying to connect to PostgreSQL by using sudo su - postgres and then psql. The problem is that I get this error : 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"?

I made some researchs and found this post explaining how to solve the problem. However, when I run sudo service postgresql start I have to type the password for postgres but I don't know what it is, I never created a password for postgres. I've made researchs about that and I can't find a solution because all solutions need to first connect to psql in order to alter the existing user. But I need first to find the password in order to solve the problem of connection to psql.

What am I supposed to do ?

Thanks in advance !

PS : I'm using windows 10 with the Ubuntu terminal.

PS2 : I've found some topics saying it's easier to install PostgreSQL and PostGIS using Docker. However, there are lots of compatibility problems with Docker due to the fact I'm using windows 10. Do you think I should use Docker ?

Julien Mertz
  • 465
  • 2
  • 8
  • 22

1 Answers1

0

I've found the solution !

So for those interested, I had to change the password in order to get log in and that solve the psql error: could not connect to server. To change the password, simply type sudo passwd postgres and set up a new password. I hope this will help other people !

Julien Mertz
  • 465
  • 2
  • 8
  • 22