postgresql之用户管理

############## 

 

 

 

 

 更改用户密码:

postgres=# alter user work password 'work';
ALTER ROLE

 

更改用户密码失效时间:

postgres=# alter user admin valid until '2023-05-13 23:12:00';
ALTER ROLE
postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of 
-----------+------------------------------------------------------------+-----------
 admin     | Superuser, Create role, Create DB                         +| {}
           | Password valid until 2023-05-13 23:12:00+08                | 
 work      | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

postgres=# 

 

postgres=# alter user admin valid until 'infinity';
ALTER ROLE
postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of 
-----------+------------------------------------------------------------+-----------
 admin     | Superuser, Create role, Create DB                         +| {}
           | Password valid until infinity                              | 
 work      | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

postgres=# 

 

 

##################

posted @ 2023-05-09 23:55  igoodful  阅读(129)  评论(1编辑  收藏  举报