Skip to content

Instantly share code, notes, and snippets.

@tangingw
Created November 24, 2023 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tangingw/f30951745e76e1283e5c950ba0e53278 to your computer and use it in GitHub Desktop.
Save tangingw/f30951745e76e1283e5c950ba0e53278 to your computer and use it in GitHub Desktop.
Postgres Add Password
# Set up Postgres
[DigitalOcean Guide for Ubuntu](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-22-04)
# Set up Password
```bash
postgres=# select passwd from pg_shadow where usename='username';
passwd
--------------
md5...
postgres=# set password_encryption = 'scram-sha-256';
SET
postgres=# alter user username with password 'secretpass';
ALTER ROLE
postgres=# select passwd from pg_shadow where usename='username';
passwd
--------------------------
SCRAM-SHA-256$...
(1 row)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment