# DBaaS Database Operations


## Rotate Database Password

```sh
# Connect to central database as the root
$ kubectl run -n nightly --rm mysql -it --image=mysql:5.7 -- mysql -hdb-tidb -P4000 -uroot -p
# (Enter password to open the sql shell)
mysql> SET PASSWORD FOR central = '<new-central-password>';
mysql> SET PASSWORD FOR billing = '<new-billing-password>';
mysql> SET PASSWORD FOR backup = '<new-backup-password>';
# (Ctrl-C to exit sql shell)
# swtich to the appliation pulumi stack
$ pulumi -C ${pulumi_dir} config set --secret centralDbPassword <new-central-password>
$ pulumi -C ${pulumi_dir} config set --secret billingDbPassword <new-billing-password>
$ pulumi -C ${pulumi_dir} config set --secret backupDbPassword <new-backup-password>
# file a PR to apply change
$ git checkout -b rotate-${ENV}-password && git add . && git commit -m "Rotating Database password for ${ENV}" && git push
```
