How to recover mysql root password

If you are using linux then you can do this very easily
I have not done this on windows machine
First of all get path of mysqld
run following command


And it will output like this
Remember path can be changed
now stop mysql server using following command

sudo service mysql stop

now start mysql with option –skip-grant-tables, –skip-networking as below

sudo /usr/sbin/mysqld --skip-grant-tables  --skip-networking &

Now open new terminal
and run following commands

sudo mysql
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');


About Jaffar Hussain

Jaffar Hussain is an Enthusiastic Software Engineer having vast experience in Zend, SugarCRM, Laravel php frameworks and good command on databases Mysql, MongoDB, SqlServer 2008.