Change MySQL root user password

Following is the procedure to change MySQL root user password.

As part of the installation of the MySQL Cluster, db_install container generates the random password and marked as expired in the MySQL SQL nodes. This password is stored in "/var/occnedb/mysqld_expired.log" file. so we need to login to the each of the MySQL SQL nodes and change the MySQL root user password.

Table B-19 Change MySQL root user password

Step No.# Procedure Description
1. Login to MySQL SQL Node VM.
2. Login using mysql client Login to mysql client as a root user
$ sudo su
$ mysql -h 127.0.0.1 -uroot -p
3. Enter expired random password for mysql root user stored in the "/var/occnedb/mysqld_expired.log" file Enter expired random password stored in "/var/occnedb/mysqld_expired.log" file.
$ mysql -h 127.0.0.1 -uroot -p
$ Enter password: 
4. Change Root Password Execute the following commands to change the root password:
$ mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '<NEW_PASSWORD>';
$ mysql> FLUSH PRIVILEGES;
Note:

Here 'NEW_PASSWORD' is the password of the mysql root user.