postgresql - Set encrypted postgres password without entering it as SQL -
this question has answer here:
i set postgres db on server, logged in postgres (peer method), created user , want set encrypted password new user.
the tutorials find say, can change password by:
alter user other_user encrypted password 'passwd';
but not feel enter password clear sql console. saved in history, , can see it.
is right way set password in postgres?
i have ~/.pgpass in home :
localhost:5432:*:postgres:123456
and query file password.txt :
alter user other_user encrypted password 'passwd';
and run command:
psql -u useradmin -h localhost -w -a -e -f password.txt
remember:
rm .psql_history
Comments
Post a Comment