Solutions: Recover(hack) MySQL root password
1. Login as root
2. Stop the MySQL server by using command
/etc/init.d/mysql stop
#or
ps aux | grep mysql
kill -9 mysqlID
3. Start MySQL server without password mysqld_safe --skip-grant-tables &
#/usr/local/mysql/bin/mysqld_safe --skip-grant-tables &
4.Connect to mysql server using mysql clientmysql -u root
5. Now you need to Setup new MySQL root user passwordmysql> use mysql;
mysql> update user set password=PASSWORD("newrootpassword") where user='root';
mysql> flush privileges;
mysql> quit
6. Restart MySQL/etc/init.d/mysql stop
/etc/init.d/mysql start