postgresql , postgis 安装

前端之家收集整理的这篇文章主要介绍了postgresql , postgis 安装前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

root权限下安装

1.安装postgresql 和 postgis

# apt-get install postgresql-8.4 postgresql-8.4-postgis

2.安装完成后会自动生成postgres 账号,进入postgres账号

#su postgres

3.执行psql,进入postgres模式

#psql postgres

4.在postgres模式下修改密码,注意执行语句后以分号结尾,

#ALTER USER postgres with PASSWORD ' 123456';

执行正常会显示 ALTER ROLE

5.postgres模式下退出

#\q

6.在postgres用户下,非数据库命令模式,创建需要用的gis0020库

psql -U postgres -c "CREATE DATABASE gis0020 WITH TEMPLATE = template0 ENCODING = 'UTF8';"

createlang -U postgres plpgsql gis0020

psql -U postgres -d gis0020 -f /usr/share/postgresql/8.4/contrib/postgis.sql

psql -U postgres -d gis0020 -f /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql

7.在postgres用户下,进入gis0020数据库

#psql -U postgres -d gis0020

8.查看数据库下的表

#\d

原文链接:https://www.f2er.com/postgresql/196828.html

猜你在找的Postgre SQL相关文章