如何在Windows中将PostgreSQL作为服务运行?

我在Windows 7 32位操作系统中安装了postgreSQL二进制文件;我可以从cmd启动服务器,但

"The postgreSQL service on local computer started and then stopped. some services stop automatically if they are not in use by other servces or programs"

我要做的就是

双击我的Java应用程序启动到Windows后,我需要流畅地运行我的应用程序而没有任何数据库错误。我不能这样做,因为postgreSQL没有作为Windows服务运行。

The description for Event ID 0 from source PostgreSQL cannot be found.

Either the component that raises this event is not installed on your local computer or the installation is corrupted.

You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

postgres cannot access the server configuration file

"C:/Windows/system32/pgsql/data/postgresql.conf": No such file or directory

我用谷歌搜索,但是找不到答案。

回答:

问题已解决Windows服务文件中数据目录的路径错误。

因此,我从此方法删除服务文件:

之后,打开cmd(以管理员身份运行),转到postgreSQL bin目录并运行以下命令以创建新的Windows服务:

pg_ctl.exe register -N "PostgreSQL" -U "NT AUTHORITY\NetworkService" -D "C:/Program Files/postgresql/pgsql/bin/pgsql/data" -w

这对我有用。希望这会有所帮助。

以上是 如何在Windows中将PostgreSQL作为服务运行? 的全部内容, 来源链接: utcz.com/qa/420573.html

回到顶部