PostgreSQL(Linux)安装、启动、停止、重启

If we don't already have PostgreSQL installed, we must install it.

$ sudo apt-get install postgresql

This command installs the PostgreSQL server and various other packages. 


$ sudo update-rc.d -f postgresql remove 
Removing any system startup links for /etc/init.d/postgresql ...
 /etc/rc0.d/K21postgresql
 /etc/rc1.d/K21postgresql 
/etc/rc2.d/S19postgresql
 /etc/rc3.d/S19postgresql
 /etc/rc4.d/S19postgresql 
/etc/rc5.d/S19postgresql 
/etc/rc6.d/K21postgresql

If we install the PostgreSQL database from packages, it is automatically added to the start up scripts of the operating system. If we are only learning to work with the database, it is unnecessary to start the database each time we boot the system. The above command removes any system startup links for the PostgreSQL database. 


$ /etc/init.d/postgresql status 
Running clusters: 9.1/main 
$ service postgresql status 
Running clusters: 9.1/main

We check if the PostgreSQL server is running. If not, we need to start the server. 


$ sudo service postgresql start 
* Starting PostgreSQL 9.1 database server [ OK ]

On Ubuntu Linux we can start the server with the service postgresql start command. 


$ sudo service postgresql stop 
 * Stopping PostgreSQL 9.1 database server [ OK ]

We use the service postgresql stop command to stop the PostgreSQL server.


$ sudo service postgresql restart

Stopping postgresql-9.5 service: [ OK ]

Starting postgresql-9.5 service: [ OK ]

We use the service postgresql restart command to restart the PostgreSQL server.


转载于:https://www.cnblogs.com/walk-the-Line/p/5407463.html

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值