How to reset MySQL root Password.

How to reset MySQL root Password

Stop MySQL and start using skip-grant-tables


service mysqld stop (Redhat)
mysqld_safe --skip-grant-tables &

That should start up mysql without the need for a root password. Once in, type


mysql
use mysql
UPDATE user SET password=PASSWORD('newpass') WHERE user='root';
FLUSH PRIVILEGES;
quit

That will reset the root password for you.


Type "killall -9 mysqld_safe; killall -9 mysqld" to shut down mysqld.

Start it up again with


/sbin/service mysqld start