1. Stop the MySQL service
[Email protected] data]#/etc/init.d/mysqld stopshutting down MySQL. success!
2. Use--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
3. Log in to MySQL, repair root password
[[email protected] data]# mysql mysql> updatemysql.user SET password=password ("123") WHERE user= ' root ' andhost= ' 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) mysql> Quitbye
4. Log out of MySQL and restart MySQL
[Email protected] data]#/etc/init.d/mysqld stopshutting down MySQL. success! [1]+ done Mysqld_safe--skip-grant-tables--user=mysql >/dev/null 2>&1[[email protected] Data ]#/etc/init.d/mysqld startstarting MySQL. success!
What does the MySQL password forget?