Recover the root MySql Password

Forget your root mysql password? That's really not good, but it's also not a fatal error. If you have root access to the box you can rememdy this problem. Basically you forcibly stop the service, tell it to start again and ignore all privileges (very insecure), reset the password, and reload the privileges.

/etc/init.d/mysqld stop safe_mysqld --user=root --pid-file=/usr/local/mysql/data/mysqld.pid --skip-grant-tables & mysql -u root mysql update user set password=password('newpass') where User='root' and host='localhost'; flush privileges;
Leave A Reply - 5 Replies
Replies
June 5th 2007 - lorgs

I am starting back my MySql and have password trouble...thank you so very much.

July 27th 2008 - laurie

Thanks a lot. I tried a bunch of other stuff from google. Yours waa the only one that worked.

December 9th 2009 - petka

Reverse MySQL hashed passwords. http://petka.biz/hash.pl

January 13th 2010 - Petka
March 31st 2010 - rie

which box did you mean that can remedy? ive been trying cmd and mysql server client. plsss help

All content licensed under the Creative Commons License