- If make user named
john
with passwordabcedf
, make md5 hash with password + username
$echo -n abcdefjohn | md5
4d9ceab746eb1791f153a8850f275954
- Create user using md5 hash
- Add
md5
prefix to md5 hash
CREATE ROLE john LOGIN INHERIT ENCRYPTED PASSWORD 'md54d9ceab746eb1791f153a8850f275954';
- Or alter user if already exists
ALTER ROLE john LOGIN INHERIT ENCRYPTED PASSWORD 'md54d9ceab746eb1791f153a8850f275954';
Then you can login with the password abcdef
when login with john.
$ psql -U john
Password for user test: # abcdef
psql
Type "help" for help.