postgresql reset user password code example
Example 1: create password for user in postgres
ALTER USER davide WITH PASSWORD 'hu8jmn3';
Example 2: reset postgres password windows
Backup the pg_hba.conf file by copying it.
Edit the pg_dba.conf, change `METHOD` to 'trust'
Restart the PostgreSQL server.
psql -U postgres.
ALTER USER postgres WITH PASSWORD 'new_password';
Restore the pg_dba.conf file.
Restart the PostgreSQL server.
Example 3: how to reset postgres password
sudo sed -ibak 's/^\([^#]*\)md5/\1trust/g' /opt/bitnami/postgresql/conf/pg_hba.conf
sudo -u postgres pg_ctl reload
Example 4: reset password postgres ubuntu
\password sde