Linux下设置postgresql数据库开机启动

PostgreSQL的开机自启动脚本位于PostgreSQL源码目录的contrib/start-scripts路径下,linux文件即为linux系统上的启动脚本:

1、将Linux文件复制到 /etc/init.d 目录下,并且将其重名为postgresql

  # cp linux /etc/init.d/postgresql   

2、进入 /etc/init.d 目录下,修改postgresql文件

  # cd /etc/init.d/   

  # vi postgresql   

然后做以下修改:

将prefix设置为postgresql的安装路径:/usr/local/postgresql

将PGDATA设置为postgresql的数据目录路径:/usr/local/postgresql/data

将PGUSER设置为postgresql的用户:admin

将PGLOG 设置为 postgresql 的数据目录的日志文件夹下:$PGDATA/pg_log/serverlog

保存退出!

3、  添加到开机启动

修改文件属性:

# chmod a+x postgresql   

添加开机启动:

# chkconfig --add postgresql  

 

服务正常开启,重启机器测试:

重启之后,开机,服务正常开启:

外部Navicat连接测试正常:

 

转载于:https://www.cnblogs.com/guoxiangyue/p/10956600.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值