Postgres数据库用户密码有效期设置

pg_user或pg_shadow中:
列valuntil值为infinity或空值表示用户密码永不过期;默认为空

修改用户密码过期时间:
alter user user_name with valid until '2018-01-01 08:00:00';

修改用户密码永不过期:
alter user user_name with valid until 'infinity';

highgo=# select * from pg_user;

usename | usesysid | usecreatedb | usesuper | usecatupd | userepl | passwd | valuntil | useconfig
---------+----------+-------------+----------+-----------+---------+----------+----------+-----------
highgo | 10 | t | t | t | t | ******** | |
a | 49231 | f | f | f | f | ******** | |
b | 49232 | f | f | f | f | ******** | |
(3 rows)


highgo=# select * from pg_shadow;
usename | usesysid | usecreatedb | usesuper | usecatupd | userepl | passwd | valuntil | useconfig
---------+----------+-------------+----------+-----------+---------+-------------------------------------+----------+-----------
highgo | 10 | t | t | t | t | md5614aeb636ab143b790547ce463ec1741 | |
a | 49231 | f | f | f | f | md5039af99d1e9a4b194e0eb800a6f8d018 | |
b | 49232 | f | f | f | f | md583aeaa4e529325e234e9c5c2e01e6c08 | |
(3 rows)
————————————————
版权声明:本文为CSDN博主「lk_db」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/lk_db/article/details/78355996

posted @ 2022-03-01 15:51  疯子110  阅读(2719)  评论(0编辑  收藏  举报