
Charmed PostgreSQL
- Canonical
- Databases
Channel | Revision | Published | Runs on |
---|---|---|---|
latest/stable | 591 | 10 Apr 2025 | |
latest/stable | 239 | 09 Feb 2022 | |
latest/stable | 226 | 01 Apr 2021 | |
14/stable | 553 | 04 Feb 2025 | |
14/stable | 552 | 04 Feb 2025 | |
14/candidate | 593 | 16 Apr 2025 | |
14/candidate | 592 | 16 Apr 2025 | |
14/beta | 605 | 27 Apr 2025 | |
14/beta | 606 | 27 Apr 2025 | |
14/edge | 741 | 06 May 2025 | |
14/edge | 740 | 06 May 2025 | |
16/candidate | 610 | 25 Apr 2025 | |
16/candidate | 609 | 25 Apr 2025 | |
16/beta | 610 | 24 Apr 2025 | |
16/beta | 609 | 24 Apr 2025 | |
16/edge | 758 | 07 May 2025 | |
16/edge | 757 | 07 May 2025 |
juju deploy postgresql --channel 14/stable
Deploy universal operators easily with Juju, the Universal Operator Lifecycle Manager.
Platform:
Charmed PostgreSQL VM Tutorial > 4. Manage passwords
Manage passwords
When we accessed PostgreSQL earlier in this tutorial, we needed to use a password manually. Passwords help to secure our database and are essential for security. Over time, it is a good practice to change the password frequently.
In this section, we will go through setting and changing the password for the admin user.
This tutorial is written for Charmed PostgreSQL 14, which has a different way of managing passwords than 16.
To learn more about managing passwords on Charmed PostgreSQL 16, see How to > Manage passwords.
Summary
- Retrieve the operator password
- Rotate the operator password
- Set a new password
- …for the operator
- …for another user
Retrieve the operator password
The operator’s password can be retrieved by running the get-password
action on the Charmed PostgreSQL VM application:
juju run postgresql/leader get-password
Running the command should output:
unit-postgresql-0:
UnitId: postgresql/0
id: "14"
results:
operator-password: eItxBiOYeMf7seSv
status: completed
timing:
completed: 2023-03-20 09:17:51 +0000 UTC
enqueued: 2023-03-20 09:17:49 +0000 UTC
started: 2023-03-20 09:17:50 +0000 UTC
Rotate the operator password
You can change the operator’s password to a new random password by entering:
juju run postgresql/leader set-password
Running the command should output:
unit-postgresql-0:
UnitId: postgresql/0
id: "16"
results:
operator-password: npGdNGNGVtu7SO50
status: completed
timing:
completed: 2023-03-20 09:18:11 +0000 UTC
enqueued: 2023-03-20 09:18:08 +0000 UTC
started: 2023-03-20 09:18:10 +0000 UTC
The status: completed
element in the output above indicates that the password has been successfully updated. The new password should be different from the previous password.
Set a new password
You can set a specific password for any user by running the set-password
juju action on the leader unit.
…for the operator user
To set a manual password for the operator/admin user, run the following command:
juju run postgresql/leader set-password password=<password>
where <password>
is your password of choice.
Example output:
unit-postgresql-0:
UnitId: postgresql/0
id: "18"
results:
operator-password: my-password
status: completed
timing:
completed: 2023-03-20 09:20:06 +0000 UTC
enqueued: 2023-03-20 09:20:04 +0000 UTC
started: 2023-03-20 09:20:05 +0000 UTC
…for another user
To set a manual password for another user, run the following command:
juju run postgresql/leader set-password username=my-user password=my-password
Read more about internal operator users here.
Next step: 5. Integrate with other applications