Add section to update the root password, so that recovery can take place

This commit is contained in:
Arif Ali 2022-04-12 11:32:17 +01:00
parent 84d03891c6
commit b6e31f8df6
Signed by: arif
GPG Key ID: 369608FBA1353A70

View File

@ -47,6 +47,31 @@ mysql-innodb-cluster/2* active idle 2/lxd/6 10.0.1.156
Check the mysql status: `sudo systemctl status mysql`
1. A temporary password would have been created via the `--initialize` above, so this needs to be updated.
You will find the temporary password in `/var/log/mysql/error.log`, and the line should look similar to the one below
```
[Note] [MY-010454] [Server] A temporary password is generated for root@localhost: wyPd_?kEd03p
```
First we need to get the root password that is stored
```
juju run --unit mysql-innodb-cluster/leader 'leader-get mysql.passwd'
```
Now, we can update the password, login using the password that was suggested in the error.log i.e. `wyPd_?kEd03p`
```
mysql -p -u root
```
Once logged in, we can update the password to the value that mysql-innodb-cluster charm knows about
```
ALTER USER 'root'@'localhost' IDENTIFIED BY 'zn8K73dmqnkZd99JZxXwcFmxWqTxPYgw3Hjx5sk';
```
1. Remove the flags using Juju:
Clear flags to force charm to re-create cluster users