1. Stop MySQL
/etc/init.d/mysql stop
2. 入Safe mode
mysqld_safe --skip-grant-tables &
3.改密碼 (Password)
mysql> use mysql;
mysql> UPDATE user SET Password=PASSWORD("password") WHERE User='root';
mysql> flush privileges;
mysql> quit
4. 重啟 MySQL
/etc/init.d/mysql start
5. 登入 MySQL
mysql -u root -p