PostgreSQL:修改数据库用户的密码

pg_hba.conf,认证设置成md5认证连接出现:

postgresql FATAL: password authentication failed for user "postgres"

编辑pg_hba.conf,将md5认证修改成trust认证,编辑后退出保存

执行pg_ctl reload加载生效

psql连接,用alter role修改密码

执行以下命令

postgres=# alter role postgres with password 'yourpassword';

修改完数据库密码后可以查看当前postgresql 有多少用户,及对应的密码

postgres=# select rolname,rolpassword from pg_authid;

退出psql

编辑pg_hba.conf,将turst认证修改成md5认证,编辑后退出保存

执行pg_ctl reload加载生效

猜你喜欢

转载自www.cnblogs.com/awakenedy/p/12322015.html