1 modificationslogin settings for MySQL
# VI/ETC/MY.CNF
Add a sentence in [mysqld]:skip-grant-tables
2 Restart mysqld
# /etc/init.d/mysqld restart
stopping MySQL: [OK]
Starting MySQL: [OK]
3 Log in and modify the root password of MySQL
# /usr/bin/mysql
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 3 to server version:3.23.56
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the buffer.
mysql> use MySQL;
Reading table information for completion of table and column names
Can turn off this feature to get a quicker startup with-a
Database changed
Mysql>UPDATE user SET Password = Password (' New-password ') WHERE user = ' root ';
Query OK, 0 rows Affected (0.00 sec)
Rows matched:2 changed:0 warnings:0
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
Mysql> quit
Bye
< Span lang= "en-US" > < Span lang= "en-US" > < Span lang= "en-US" > 4 will mysql login settings back
< Span lang= "en-US" > < Span lang= "en-US" > # vi/etc/my.cnf
Add >[mysqld skip-grant-tables delete
Save and exit vi.
5 restart mysqld
#/etc/init.d/mysqld Restart
stopping MySQL: [OK]
Starting MySQL: [OK]
Work for Fun,livefor love!
Linux MySQL forgot root password solution