/etc/init.d/mysql stop
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
mysql -u root mysql
update user set authentication_string=password('123456') where user='root';
FLUSH PRIVILEGES;
exit;
/etc/init.d/mysql restart
mysql -uroot -p
Enter password: 123456
mysql>
出現上面mysql> 說明成功!