Category Archives: mysql

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

which

And it will output like this
/usr/sbin/mysqld
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
FLUSH PRIVILEGES;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');

Reference:
http://dev.mysql.com/doc/refman/5.6/en/resetting-permissions.html