Charmed MySQL
- Canonical
- Cloud
Channel | Revision | Published | Runs on |
---|---|---|---|
8.0/stable | 240 | 20 Jun 2024 | |
8.0/candidate | 306 | 14 Nov 2024 | |
8.0/candidate | 305 | 14 Nov 2024 | |
8.0/beta | 306 | 14 Nov 2024 | |
8.0/beta | 305 | 14 Nov 2024 | |
8.0/edge | 306 | 14 Nov 2024 | |
8.0/edge | 305 | 14 Nov 2024 |
juju deploy mysql --channel 8.0/candidate
Deploy universal operators easily with Juju, the Universal Operator Lifecycle Manager.
Platform:
Charmed MySQL Tutorial > 4. Manage passwords
Manage passwords
When we accessed MySQL 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.
This section will go through setting and changing the password for the admin user.
Summary
Retrieve the root password
The root user’s password can be retrieved by running the get-password
action on the Charmed MySQL application:
juju run mysql/leader get-password
Example output:
...
password: yWJjs2HccOmqFMshyRcwWnjF
username: root
Rotate the root password
You can change the root user’s password to a new random password by running:
juju run mysql/leader set-password
Example output:
Running operation 12 with 1 task
- task 13 on unit-mysql-1
Waiting for task 13...
status: completed
The status: completed
above means the password has been successfully updated. To be sure, call get-password
once again to check that the root password is different from the previous password.
Set the root password
You can change the root password to a specific password by running:
juju run mysql/leader set-password password=my-password && \
juju run mysql/leader get-password
Example output:
Running operation 18 with 1 task
- task 19 on unit-mysql-1
Waiting for task 19...
Running operation 20 with 1 task
- task 21 on unit-mysql-1
Waiting for task 21...
password: my-password
username: root
The root password
should match whatever you passed in when you entered the command.
Next step: 5. Integrate with another application