0
0
Fork 0
zblog/content/post/88.md

17 lines
667 B
Markdown
Raw Normal View History

+++
title = "create encrypted password for postgresql"
date = "2012-06-25T13:46:31+00:00"
author = "Gibheer"
draft = false
+++
If you ever have the need to generate an encrypted password to put it into scripts or anything else, then you can use the following SQL command to generate it:
select 'md5'||md5('password'||'rolename');
or in shell
echo -n 'passwordrolename' | md5sum | awk '{ print "md5" $1 }'
Important is, that your rolename is appended to your password and this construct then put into md5. The important piece in the source is [pg_md5_encrypt()](http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/libpq/md5.c)