009.PGSQL-pgsql在windows下的安装启动

安装
https://www.yoytang.com/postgres-windows-install-and-config.html

下载最新的zip包 http://get.enterprisedb.com/postgresql/postgresql-9.5.2-1-windows-x64-binaries.zip

配置环境变量

initdb -D  E:postgresqlpgsql12data  -U postgres

postgres -D E:postgresqlpgsql12data

登陆
E:postgresqlpgsqlin>psql -h localhost -U postgres -d postgres -p 5432
-h:数据库IP
-U:登录用户
-d:登录的数据库
-p:登录端口

修改密码
alter user postgres with password '123456';

查看数据库

l

进入对应的库

退出数据库
q

 

重启服务
pg_ctl -D "E:postgresqlpgsqldata" -l logfile restart

pg_ctl -D "E:postgresqlpgsqldata" -l logfile start

查看状态
pg_ctl -D "E:postgresqlpgsqldata" -l logfile status


关闭服务
pg_ctl -D "E:postgresqlpgsqldata" -l logfile stop

原文地址:https://www.cnblogs.com/star521/p/13468311.html