I need to save a database to an external HDD. This question has been asked previously here. However, upon changing the data_directory
variable in the postgresql.conf
file that exists in /usr/local/var/postgres/
to
data_directory = /path/to/externalHDD/directory/
I then restart the PostgreSQL server with brew services restart postgresql
, but when I try to reconnect to the database via
psql -U username -d postgres
I receive the following error:
psql: error: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
How do I fix this?