简体   繁体   中英

PostgreSQL pg_ctl register error under Windows 7

Under Windows 7, PostgreSQL 9.3.2, I'm trying to register as a service a second instance of PostgreSQL on the same server, using a different port number and data directory. The 2nd cluster was successfully created with the initdb command, under C:\\Program Files\\PostgreSQL\\9.3\\data2.

When I run the following pg_ctl register command from C:\\Program Files\\PostgreSQL\\9.3\\bin, I get an error message:

pg_ctl register -N postgresql9.2_2nd_cluster -U "NT AUTHORITY\NetworkService" -D "C:\Program Files\PostgreSQL\9.3\data2" -S auto -o "-p 5431"

pg_ctl: could not open service manager

I googled this, but without much success.

This error:

pg_ctl: could not open service manager

would suggest that you're probably on a UAC-enabled machine, and you're running in a non-admin console.

When you launch your console from Start->Command Prompt, right click on it and choose "Run as Administrator".

  • Open Command Prompt as admin
  • Open services (win+R -> services.msc)
  • If u can see PostgreSQL, then unregister it.
  • To Unregister the PostgreSQL,
 pg-ctl unregister [-N SERVICENAME] **%path%\\PostgreSQL\\12\\bin\\pg_ctl unregister -N "service_name"**

*service name will be displayed on services 服务

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM