1

I wanted to move my PostgreSQL data folder on my Ubuntu server and I was following this tutorial to move it.

I was able to move it, and update my conf file to point to the new location.

When I go to run Postgres, it starts, but when I try to connect via

sudo -u postgres psql

It gives me this error:

psql: 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"?

Any ideas what happened? It says it's running.

0

1 Answer 1

1

After done moving PostgreSQL data directory. Don't forget to restart the PostgreSQL service.

Check the PostgreSQL status by command ps -ef | grep postgres. -D parameter value should be new directory location.

ERROR /var/run/postgresql/.s.PGSQL.5432 that's mean your PostgreSQL service not starting up Properly or Failed to when starting up.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, that did it. I started it up, but it failed. You gave me an idea of tailing the log file in /var/log and found out that it had an issue with the data folder, and then after that I had to chmod the dir to 700.
just remember PostgreSQL data directory need 700 access permission. that mean only PostgreSQL user and root can access it. Thank you for adding this answer. and thanks for the upvote. mark as answer is good too. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.