一.下载
选择相应版本进行下载,本文选择Windows x86-64 11.2版本进行安装

二.安装(重要步骤说明)
1.为postgres设置密码

2.设置端口,默认为5432

3.PostgreSQL安装完毕
注意勾中图中选项,准备安装postgis拓展工具

4.进入安装向导
选择需要拓展的目标软件(刚安装完成的PostgreSQL)

5.选择PostGIS拓展选项

6.安装PostGIS
点击下一步安装PostGIS,勾选Create spatial database创建控件数据库,之后新建空间数据库可以以此数据库为模板建库

7.输入之前设置的postgres用户密码
点击‘下一步’或者‘是’直至安装完成

三.初步使用
1.打开管理界面

2.登录
点击数据库后输入密码登录


四.问题解决
1.建立pg数据库如果没有postgis模板,可以在pgAdmin平台上用普通模板建库,然后在SQL Shell中对此库添加扩展,然后下次建库就可以以postgis库为模板建库。参考:postgresql创建空间数据库 - CSDN博客(此步骤可以用application stack builder工具自动配置)
2.安装时报c++运行时错误。安装PostgreSQL时出现VC++ runtime error的解决方法 - 似水流年 - CSDN博客
3.远程连接数据库报错:
1).将data文件夹中的postgresql.conf文件中的listen_addresses = 'localhost' 修改为listen_addresses = '*'

2).修改data文件夹中的pg_hba.conf文件,填加如下内容:(表示允许网段172.18.84.0上的所有主机使用所有合法的数据库用户名访问数据库,并提供加密的密码验证。其中,数字24是子网掩码,表示允许172.18.84.0--172.18.84.255的计算机访问)

网友评论