如何重新启动 Postgresql
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34918025/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to restart Postgresql
提问by Tony Joseph
I have Postgresql 9.3 and 9.4 installed on my Linux Mint machine. How can I restart postgresql 9.4? A method to restart both versions together is also fine.
我的 Linux Mint 机器上安装了 Postgresql 9.3 和 9.4。如何重新启动 postgresql 9.4?将两个版本一起重新启动的方法也很好。
回答by EnzoR
Try this as root (maybe you can use sudo
or su
):
以 root 身份尝试此操作(也许您可以使用sudo
或su
):
/etc/init.d/postgresql restart
Without any argument the script also gives you a hint on how to restart a specific version
在没有任何参数的情况下,脚本还会提示您如何重新启动特定版本
[Uqbar@Feynman ~] /etc/init.d/postgresql
Usage: /etc/init.d/postgresql {start|stop|restart|reload|force-reload|status} [version ...]
Similarly, in case you have it, you can also use the service
tool:
同样,如果您拥有它,您也可以使用该service
工具:
[Uqbar@Feynman ~] service postgresql
Usage: /etc/init.d/postgresql {start|stop|restart|reload|force reload|status} [version ...]
Please, pay attention to the optional [version ...]
trailing argument.
That's meant to allow you, the user, to act on a specific version, in case you were running multiple ones. So you can restart version Xwhile keeping version Yand Zuntouched and running.
请注意可选的[version ...]
尾随参数。这意味着允许您(用户)对特定版本进行操作,以防您运行多个版本。因此,您可以重新启动版本X,同时保持版本Y和Z不变并运行。
Finally, in case you are running systemd, then you can use systemctl
like this:
最后,如果您正在运行systemd,那么您可以systemctl
像这样使用:
[support@Feynman ~] systemctl status postgresql
● postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2017-11-14 12:33:35 CET; 7min ago
...
You can replace status
with stop
, start
or restart
as well as other actions. Please refer to the documentationfor full details. Unluckily there seems to be no way to operate on multiple versions of Postgresql with this tool.
Finally Keep in mind that root
permissions may be needed for non-informative tasks as in the other cases seen earlier.
您可以替换status
为stop
,start
或restart
以及其他操作。有关完整详细信息,请参阅文档。不幸的是,似乎无法使用此工具对多个版本的 Postgresql 进行操作。最后请记住,root
与之前看到的其他情况一样,非信息性任务可能需要权限。
回答by Aditi
You can also restart postgresql by using this command, should work on both the versions :
您还可以使用此命令重新启动 postgresql,应该适用于两个版本:
sudo service postgresql start
sudo service postgresql start
回答by Sobhan
On Windows :
在 Windows 上:
1-Open Run Window by Winkey + R
1-打开运行窗口 Winkey + R
2-Type services.msc
2型 services.msc
3-Search Postgres service based on version installed.
3-根据安装的版本搜索 Postgres 服务。
4-Click stop, start or restart the service option.
4 单击停止、启动或重新启动服务选项。
回答by sogu
macOS:
苹果系统:
- On the top left of the menu bar you have the Postgres Icon
- Click on it this opens a drop down menu
- Click on Stop -> than click on start
- 在菜单栏的左上角你有 Postgres 图标
- 单击它会打开一个下拉菜单
- 点击停止->点击开始
回答by Yankee
This should work:
这应该有效:
sudo systemctl stop postgresql
sudo systemctl stop postgresql
sudo systemctl start postgresql
sudo systemctl start postgresql