国内最全IT社区平台 联系我们 | 收藏本站
华晨云阿里云优惠2
您当前位置:首页 > php开源 > 综合技术 > Postgresql 在Windows下的详细安装步骤

Postgresql 在Windows下的详细安装步骤

来源:程序员人生   发布时间:2013-11-08 07:13:20 阅读次数:2950次

1.将下载的压缩包解压,我是解压在D:postgreSQLpgsql中。

2.设置环境变量如下:

set PGHOME=D:postgreSQLpgsql
set PGDATA=%PGHOME%data
set PGLIB=%PGHOME%lib
set PGHOST=localhost
set PATH=%PGHOME%in;%PATH%

3.创建数据库,利用pgsqlin目录下的initdb.exe命令,我用的格式如下:

view sourceprint?1 initdb --locale=CHS -E UTF8 -D "myPostgre" -U postgre –W postgre
view sourceprint?1 关于initdb的详细参数,可以用initdb --help来查看。
view sourceprint?1 若是执行成功,有如下log信息:

creating directory postgre ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in postgre/base/1 ... ok
initializing pg_authid ... ok
Enter new superuser password:
Enter it again:
setting password ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

上面红色的地方需要输入数据库超级用户的密码。

4.成功安装后,在windows中添加用户 postgre,该用户就是之前在initdb命令中-U 后的用户名。

5.启动数据库和停止数据库的命令为: 

pg_ctl -D "myPostgre" start
pg_ctl -D "myPostgre" stop 
然后就可以开始postgresql的学习之旅了。

欢迎网友在网投稿或反馈意见。

生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠
程序员人生
------分隔线----------------------------
分享到:
------分隔线----------------------------
关闭
程序员人生