no-installer postgreSQL完全手动安装
网上介绍如何手动安装pg的文章:首先下载postgresql-8.1.4-1-binaries-no-installer.zip,假设解压后的目录是:D:\GreenAPP\pgsql(下面使用"$PG"表示该目录)。在"$PG"目录下创建一个rootpass.txt文件,内容为数据库的超级用户密码。准备工作到此结束,下面的步骤以管理员身份执行。
移动DLL文件:
cd $PG
move /y lib\comerr32.dll bin\
move /y lib\krb5_32.dll bin\
move /y lib\libeay32.dll bin\
move /y lib\libiconv-2.dll bin\
move /y lib\libintl-2.dllbin\
move /y lib\libpq.dll bin\
move /y lib\pthreadGC2.dll bin\
move /y lib\ssleay32.dll bin\ 添加新的postgres用户,并将密码设为:p
net user postgres p /ADD /EXPIRES:NEVER /PASSWORDCHG:NO
net localgroup users postgres /delete 创建data目录并设置访问权限:
md data
cacls . /T /E /P postgres:R
cacls data /T /E /P postgres:C 初始化PostgreSQL数据库,切换用户时需要手动输入postgres用户的密码:p
runas /noprofile /env /user:postgres "bin\initdb -D data -E EUC_CN --locale=\"Chinese_People's Republic of China.936\" -A md5 -U root --pwfile=rootpass.txt" 这样就安装好了。需要说明的是数据库默认编码为:EUC_CN(GB2312),区域设置为:zh_CN.GBK,数据库超级用户名为:root,密码为rootpass.txt文件内容,使用md5认证。
以后可以使用:
runas /noprofile /env /user:postgres "$PG\bin\pg_ctl start -w -D $PG\data" 启动PG,使用:
$PG\bin\pg_ctl stop -D $PG\data -m smart 关闭PG。
页:
[1]