1.先停止MySQL
#/etc/init.d/mysql stop
2.輸入下列即可進入mysql# mysqld_safe --skip-grant-tables &
3. 換成root
#mysql -u root
4.出現mysql> 後輸入下列指令mysql> use mysql;
mysql> update user set password=PASSWORD("newpassword") where User='root';
mysql> flush privileges;
mysql> quit
mysql> update user set password=PASSWORD("newpassword") where User='root';
mysql> flush privileges;
mysql> quit
5.再啟動MySQL
#/etc/init.d/mysql start