CentOS 7 PostgreSQL 指定数据库目录

 

mkdir /pgdata
chown -R postgres.postgres /pgdata
chcon -t postgresql_db_t /pgdata
su postgres
/usr/pgsql-9.5/bin/initdb -D /pgdata
chkconfig postgresql-9.5 on
cp /usr/lib/systemd/system/postgresql-9.5.service /etc/systemd/system/postgresql-9.5.service
vim /etc/systemd/system/postgresql-9.5.service

编辑 Environment=PGDATA=/pgdata
顶部增加 include /lib/systemd/system/postgresql-9.5.service
保存

reboot

 

posted @ 2016-08-19 14:51  泉青23  阅读(1992)  评论(0编辑  收藏  举报