I followed this post:https://www.digitalocean.com/community/tutorials/how-to-move-a-postgresql-data-directory-to-a-new-location-on-ubuntu-18-04 from digitalocean but didn't work.
This is the error I get:
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"?
-
Show us each step, exactly what you input for that step, and the complete output of that step.– user535733Feb 14, 2020 at 18:15
1 Answer
From Error it looks like you changed data directory but did not configure proper path of it and server is not able to find location of data directory.
You need to make sure that proper configuration is in the place in configuration file according to your PostgreSQL setup.
Find configuration file of your PostgreSQL setup according to your version and crosscheck data dir configuration.
sudo nano /etc/postgresql/<Postgresql_version>/main/postgresql.conf
data_directory = '<path of new dir>'