MySQL Single instance root password recovery method:
A Stop MySQL service
[[email protected] data]#/etc/init.d/mysqld stop
Shutting down MySQL. success!
b using--skip-grant-tables to start MySQL, ignoring authorization login verification
[Email protected] data]# mysqld_safe--skip-grant-tables--user=mysql >/dev/null 2>&1 &
[1] 30246
C log in to MySQL, repair root password
[[email protected] data]# MySQL
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 1
Server version:5.6.34 Source Distribution
Copyright (c), Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
mysql> UPDATE mysql.user SET password=password ("123") WHERE user= ' root ' and host= ' localhost ';
Query OK, 0 rows Affected (0.00 sec)
Rows matched:1 changed:0 warnings:0
mysql> flush Privileges;
Query OK, 0 rows affected (0.01 sec)
D quit MySQL and restart MySQL
Mysql> quit
Bye
[[email protected] data]#/etc/init.d/mysqld stop
Shutting down MySQL. success!
[1]+ done Mysqld_safe--skip-grant-tables--user=mysql >/dev/null 2>&1
[[email protected] data]#/etc/init.d/mysqld start
Starting MySQL. success!
E to log in to view
[Email protected] data]# mysql-uroot-p123
Warning:using a password on the command line interface can is insecure.
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 1
Server version:5.6.34 Source Distribution
Copyright (c), Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql>
This article from "11714322" blog, declined reprint!
MySQL Single instance forgot password how to login process