加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Postgresql 9.4.0-1 x64 win7 解压版安装步骤

发布时间:2020-12-13 17:23:09 所属栏目:百科 来源:网络整理
导读:一、下载解压 1, 下载 postgresql-9.4.0-1-windows-x64-binaries.zip 2, 解压 postgresql-9.4.0-1-windows-x64-binaries.zip 到E: 二、添加用户 1, 添加 windows 用户,用于启动 PostgreSQL 的 windows 服务 netuserpostgrespgsqlpw/add/expires:never/pass

一、下载解压

1,下载postgresql-9.4.0-1-windows-x64-binaries.zip

2,解压postgresql-9.4.0-1-windows-x64-binaries.zip到E:

二、添加用户

1,添加windows用户,用于启动PostgreSQLwindows服务
netuserpostgrespgsqlpw/add/expires:never/passwordchg:no

2,为保证安全,此用户不允许本地登录
netlocalgroupuserspostgres/del

3,赋于windows用户postgres访问PostgreSQL安装目录的权限
cacls./T/E/Ppostgres:R

4、配置环境变量:

三、初始化数据库

1、配置环境变量:

PG_HOME=E:postgresql-9.4.0-1-windows-x64

PGDATA=%PG_HOME%data

PGHOST=localhost

PGLIB=%PG_HOME%lib

Path=%path%;%PG_HOME%bin;

2,切换到windows用户postgres的命令行环境
runas/noprofile/env/user:postgrescmd

注:用管理员账号,把postgres账号初始化,改下密码就可以了。

3,初始化数据库,若不使用-Uadmin,则数据库里自动添加当前windows用户(postgres)为数据库帐号
initdb.exe-DE:postgresql-9.4.0-1-windows-x64data-EUTF-8--locale=chs

4,启动数据库
pg_ctl.exe-DE:postgresql-9.4.0-1-windows-x64data-llogfilestart

5,停止数据库
pg_ctl.exe-DE:postgresql-9.4.0-1-windows-x64datastop

四、注册为Windows服务

1,注册为windows服务,当前windows用户(postgres)将作为PostgreSQL服务的登录用户
pg_ctl.exeregister-DE:postgresql-9.4.0-1-windows-x64data-NPostgreSQL

2,启动PostgreSQL服务
netstartPostgreSQL

连接测试

psql-Upostgres-W

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读