Windows 中的 PostgreSQL 无法在后台 运行 服务器
PostgreSQL in Windows can't run server in background
我有这个问题。我安装的时候OS是Windows server 2012。 postgresql-10
我打开一个 cmd.exe windows 并编写脚本
pg_ctl -D "\My postgres path\data" start
那么,服务器是运行ning。一切都很好。
但是当我关闭命令时
我的 postgres 服务已关闭。 我的pg_ctl状态显示:
pg_ctl: no server running.
那么,我怎样才能 运行 postgres 像 linux OS
sudo service postgres start
尽管我关闭了 vim windows。
,它仍会 运行 在后台运行我找到了答案。
这很简单。
只需要在cmd.exe
中编写脚本pg_ctl register
它会将 "postgreSQL" 服务注册到 "services.msc"。
然后执行services.msc并启用它。
完成了!!!