首先停止mysql服務
service mysqld stop
以跳過授權的方式啓動mysql
mysqld_safe --skip-grant-tables &
以root用戶登錄mysql
mysql -u root
操作mysql庫的user表,進行update
mysql> use mysql;
mysql> update user set password=password('654321') where user='root' and host='localhost';
mysql> flush privileges;
mysql> quit
重啓mysql服務
service mysqld restart