我正在使用 Windows 8 笔记本电脑作为我的开发服务器。
我正在尝试在笔记本电脑上安装 postgres,但出现以下错误:
运行安装后步骤时出现问题。安装可能无法正确完成。数据库集群初始化失败。
这是我努力的视频(请原谅质量太差,因为今天之前我还没有使用过屏幕捕获软件):
http://youtu.be/LwhqCXiji8E
安装文件:
fixing permissions on existing directory C:/postgres/data ... ok
creating subdirectories ... ok
selecting default max_connections ... The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
10
selecting default shared_buffers ... The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
400kB
creating configuration files ... ok
creating template1 database in C:/postgres/data/base/1 ... The system cannot find the path specified.
child process exited with exit code 1
initdb: removing contents of data directory "C:/postgres/data"
Called Die(Failed to initialise the database cluster with initdb)...
Failed to initialise the database cluster with initdb
Script stderr:
Program ended with an error exit code
Error running cscript //NoLogo "C:\postgres/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "****" "C:\postgres" "C:\postgres\data" 5432 "DEFAULT" 0 : Program ended with an error exit code
Problem running post-install step. Installation may not complete correctly
The database cluster initialisation failed.
答案1
从http://www.windows-commandline.com/add-user-to-group-from-command-line/
Solution:
- Uninstall PostgreSQL
- net user postgres /delete
- Control Panel -> User Accounts -> Configure advanced user profile properties -> delete all "Unknown User" instances that seem to be left from postgres
- compmgmt.msc -> Local Users and Groups -> Users -> New User... -> User name: postgres, Password: postgrespass -> Create
- compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Add... -> Administrators -> OK
- copy postgresql-8.4.9-1-windows.exe to C:\
- runas /user:postgres cmd.exe -> cd \ -> postgresql-8.4.9-1-windows.exe -> installed successfully without errors. Checked data folder and confirmed files created successfully.
- compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Administrators -> Remove
- compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Add... -> Power Users -> OK
- Installed HM2 -> created db successfully
- Restarted computer -> HM2 runs properly (i.e. just to check postgresql service starts automatically)