我在Debian 8上,想要为我的数据库设置一个非默认的目录。我安装了原始版本的PostgreSQL 9.4(所以还没有用户数据库)。我找到了这篇文章http://climber2002.github.io/blog/2015/02/07/install-and-configure-postgresql-on-ubuntu-14-dot-04/,讲述了如何配置新的数据目录。这是正确的方法吗?谢谢。
是的。停止服务器 service postgresql stop
,创建新目录并将其 chown
给 postgres 用户,编辑 /etc/postgresql/9.4/main/postgresql.conf
将 data_directory
更改为新目录。使用 initdb -D /new_dir
初始化目录,然后重新启动 postgresql 服务器。