找到安装目录下的data,打开文件夹,找到pg_hba.conf。
用记事本格式打开,拉到最下面,找到所有md5,全都改为trust。
用postgres用户免密码登录即psql控制台,修改密码。
postgres# ALTER USER postgres WITH PASSWORD 'yourpassword';