官网下载地址:https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
使用命令行切到postgre安装目录的bin目录下,
执行
initdb.exe -D ../data
命令,再重新执行
pg_ctl.exe start -D …\data
命令 提示服务已经启动。
使用命令
pg_ctl.exe register -N “pgsql” -D “C:\Program Files\PostgreSQL\12\data”
将postgresql注册为服务
执行
net start pgsql
启动服务
pgsql连接默认用户名为本机系统用户名 密码任意
# 登录数据库
psql -U postgres
# 修改密码
alter user postgres with password 'new password';
# 退出数据库
\q