简体   繁体   中英

setting up postgresql/constantly giving me error could not connect to server:

Hello I'm trying to use postgresql, on my digital ocean provided server.
I did $ sudo apt-get install postgresql then $ sudo su postgres then $ createuser -P djangousr but then now I get an error:

createuser: could not connect to database postgres: 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 googled around but just couldn't find a solution. any help would be appreciated

I've run into this error, too. Try this command

ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432

This worked out for me... Hope that helps!

Once you install the server, you have to configure it - it should have prompted to configure it for you. If it didn't, run the following command to reset the installation:

sudo apt-get update
sudo apt-get remove --purge postgresql
sudo apt-get install postgresql postgresql-contrib

Once they finish, then follow this tutorial . To test if everything is working, the following commands should get you to the postgresql shell:

sudo -i -u postgres
psql

Use \\q to quit the shell.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM