Password reset

Resetting of the password is done via adding 2 parameters in the /etc/my.cnf file:

[mysqld]
skip-grant-tables
skip-networking

After these lines are added in your configuration file, restart the server and log in without password:

[root@mysqlsqlnodea ~]# service mysqld stop
Redirecting to /bin/systemctl stop mysqld.service
[root@mysqlsqlnodea ~]# vi /etc/my.cnf
--edit the parameters with the ones above
[root@mysqlsqlnodea ~]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@mysqlsqlnodea ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.19-ndb-7.5.7-cluster-gpl-log MySQL Cluster Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Reset the password using the following syntax:

mysql> flush privileges;
Query OK, 0 rows affected (0.18 sec)

mysql>
mysql> UPDATE mysql.user SET Password=PASSWORD('Welcome01') WHERE User='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0
mysql> exit
Bye

Edit the configuration file again to remove these lines, restart the service and log in using the password

[root@mysqlsqlnodea ~]# vi /etc/my.cnf
[root@mysqlsqlnodea ~]# service mysqld stop
Redirecting to /bin/systemctl stop mysqld.service
[root@mysqlsqlnodea ~]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@mysqlsqlnodea ~]# mysql -uroot -p
Enter password: <- Password
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.19-ndb-7.5.7-cluster-gpl-log MySQL Cluster Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>