如何在 Windows 上启动 PostgreSQL?

问题描述:

我已经在我的 Windows 10 PC 上安装了 Postgresql.我已经使用 pgAdmin II 工具创建了一个名为 company 的数据库,现在我想启动数据库服务器运行.我无法弄清楚如何做到这一点.我已经在 postgres 命令行上运行了 start 命令,但似乎没有任何反应.

I have installed Postgresql on my Windows 10 PC. I have used the pgAdmin II tool to create a database called company, and now I want to start the database server running. I cannot figure out how to do this. I have run the start command on the postgres command line, and nothing seems to happen.

我在做什么:

postgres=# pg_ctl start
postgres=# pg_ctl status
postgres=# pg_ctl restart
postgres=# pg_ctl start company
postgres=# pg_ctl status

.....-> 我没有看到任何返回.

.....-> I am seeing nothing returned.

进入安装 Postgres 的 C 盘中的 bin 文件夹.在 git bash 或命令提示符下运行以下命令:

Go inside bin folder in C drive where Postgres is installed. run following command in git bash or Command prompt:

pg_ctl.exe restart -D "<path upto data>"

例如:

pg_ctl.exe restart -D  "C:Program FilesPostgreSQL9.6data"

另一种方式:在运行弹出窗口(windows + R)中输入services.msc".这将显示所有正在运行的服务从列表中选择 Postgres 服务,然后单击启动/停止/重启.

Another way: type "services.msc" in run popup(windows + R). This will show all services running Select Postgres service from list and click on start/stop/restart.

谢谢