1. /etc/init.d/mysql stop
  2. mysqld_safe —user=mysql —skip-grant-tables —skip-networking &
  3. mysql -u root
  4. mysql> flush privileges;
  5. mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘newpassword’;
  6. mysql> quit;
  7. /etc/init.d/mysql restart
  8. mysql -u root -p # newpassword