pg用户角色密码默认使用md5加密

来源:互联网 发布:淘宝乔丹是真的吗 编辑:程序博客网 时间:2024/04/29 20:21
postgres9.6@[local]:5432 postgres#  create role r_test unencrypted password 'hello123' login;
CREATE ROLE
Time: 2.422 ms
postgres9.6@[local]:5432 postgres# select * from pg_shadow                                   
;
   usename   | usesysid | usecreatedb | usesuper | userepl | usebypassrls |               passwd                | valuntil | useconfig 
-------------+----------+-------------+----------+---------+--------------+-------------------------------------+----------+-----------
 b           |    16389 | f           | f        | f       | f            | md583aeaa4e529325e234e9c5c2e01e6c08 | NULL     | NULL
 test        |    16385 | f           | f        | f       | f            | md505a671c66aefea124cc08b76ea6d30bb | NULL     | NULL
 a           |    16388 | f           | f        | f       | f            | md5039af99d1e9a4b194e0eb800a6f8d018 | NULL     | NULL
 postgres9.6 |       10 | t           | t        | t       | t            | md5ad3e154e45b3eee89b51fdf2e60dafc6 | NULL     | NULL
 r_test      |    32788 | f           | f        | f       | f            | hello123                            | NULL     | NULL
(5 rows)


Time: 0.767 ms
postgres9.6@[local]:5432 postgres# create role c login password 'cccccc';
CREATE ROLE
Time: 3.847 ms
postgres9.6@[local]:5432 postgres# select * from pg_shadow               
;
   usename   | usesysid | usecreatedb | usesuper | userepl | usebypassrls |               passwd                | valuntil | useconfig 
-------------+----------+-------------+----------+---------+--------------+-------------------------------------+----------+-----------
 b           |    16389 | f           | f        | f       | f            | md583aeaa4e529325e234e9c5c2e01e6c08 | NULL     | NULL
 test        |    16385 | f           | f        | f       | f            | md505a671c66aefea124cc08b76ea6d30bb | NULL     | NULL
 a           |    16388 | f           | f        | f       | f            | md5039af99d1e9a4b194e0eb800a6f8d018 | NULL     | NULL
 postgres9.6 |       10 | t           | t        | t       | t            | md5ad3e154e45b3eee89b51fdf2e60dafc6 | NULL     | NULL
 r_test      |    32788 | f           | f        | f       | f            | hello123                            | NULL     | NULL
 c           |    32789 | f           | f        | f       | f            | md5e24b312f819219ec10b8b391a44d4974 | NULL     | NULL
(6 rows)


Time: 0.824 ms
postgres9.6@[local]:5432 postgres# select md5('ccccccc');   -->括号中格式为“密码+用户名”
               md5                
----------------------------------
 e24b312f819219ec10b8b391a44d4974
(1 row)


Time: 0.276 ms
原创粉丝点击