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:\postgresql\pgsql12\data -U postgres
postgres -D E:\postgresql\pgsql12\data
登陆
E:\postgresql\pgsql\bin>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:\postgresql\pgsql\data" -l logfile restart
pg_ctl -D "E:\postgresql\pgsql\data" -l logfile start
查看状态
pg_ctl -D "E:\postgresql\pgsql\data" -l logfile status
关闭服务
pg_ctl -D "E:\postgresql\pgsql\data" -l logfile stop