Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to change in postgresql password of the user using SQL. I have user (alex) and his password (e.g. pass) i need to change using sql statement his password to NULL...

share|improve this question

The syntax for changing a user's password is

ALTER USER username WITH PASSWORD 'password';
share|improve this answer

You want


You will of course have to do this as a Postgres superuser.

Unfortunately, that doesn't let you log in with a blank password. You can only log in without a password if your pg_hba.conf entry specifies an auth type of 'trust' instead of 'md5' or 'password'.

So this SQL command is just cleaning up the password for a user that used to have one, but who is now trusted to get in without a password. You can't actually authenticate with a blank password. The distinction is slight.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.