Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL change the data directory [closed]

I'm on Debian 8 and want to have another than the default directory for my databases. I have a vanilla install of PostgreSQL 9.4 (so no user databases yet). I found this http://climber2002.github.io/blog/2015/02/07/install-and-configure-postgresql-on-ubuntu-14-dot-04/ about configuring a new data directory. Is this the correct way for doing this (or not)?

Thanks.

like image 596
guyd Avatar asked Jun 18 '16 20:06

guyd


Video Answer


1 Answers

Yes. Stop the server service postgresql stop, create the new directory and chown it to postgres, edit /etc/postgresql/9.4/main/postgresql.conf changing data_directory to the new directory. Initiate the directory with initdb -D /new_dir and then restart the postgresql server.

like image 77
Fabrizio Mazzoni Avatar answered Sep 18 '22 23:09

Fabrizio Mazzoni