请大家帮帮忙,这是什么样的情况? 在有的win7下没问题,有的就出现了下面的问题 谢谢
在win7下 通过bat文件运行安装postgresql,但是在bat安装的过程中出现:
pg_ctl:无法打开服务管理器
服务名无效
createdb:could not connect to database postgres:无法联接到服务器:connection refused(oxooo0274D/10061)
服务器是否在主机“???”上运行并且准备接受在端口
3379 上的 TCP/IP 联接?
createuser:could not connect to database postgres:无法联接到服务器:connection refused(oxooo0274D/10061)
服务器是否在主机“???”上运行并且准备接受在端口
3379 上的 TCP/IP 联接?
psql:无法联接到服务器:connection refused(oxooo0274D/10061)
服务器是否在主机“???”上运行并且准备接受在端口
3379 上的 TCP/IP 联接?
源代码如下:
@echo off
REM query the service
sc query |find /i "pgsqldbclassic" >nul 2>nul
REM is the service exits goto pgsqlExist
if not errorlevel 1 (goto pgsqlExist) else goto pgsqlNotExist
:pgsqlNotExist
set PGHOME=pgsql
set currentPath=%~dp0
set PGPATH=%currentPath%%PGHOME%
cd %~d0
cd %PGPATH%\bin
echo ::::%PGPATH%\bin
initdb -U postgres -D %PGPATH%\data --encoding=utf8 --locale=C
echo ....%PGPATH%\data
pause
rem 等待
echo wait 1 seconds:
rem 将生产的postgresql.conf替换为端口号为3379的postgresql.conf
cd..
cd..
replace /r %currentPath%ini\setup\postgresql.conf %currentPath%\pgsql\data
cd %PGPATH%\bin
echo ))))%PGPATH%\bin
pause
pg_ctl register -D %PGPATH%\data -Npgsqldbclassic
net start pgsqldbclassic
cd %PGPATH%\bin
createdb -E UTF8 -U postgres -p 3379 hspower
createuser -p3379 -U postgres -s hsuper
rem createuser -U postgres -p3379 -P hscrm
rem 使用外部sql语句创建hscrm用户
set PGPASSWORD=
psql -p3379 -Uhsuper -S -c "create user hscrm with password 'xtpass67'" hspower
echo 换文件
psql -p3379 -Uhsuper -dhspower < %currentPath%ini\setup\hspowerplain.backup
谢谢