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/ --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
lorgs 2007-06-05 06:03pm - lorgsdiaz@... - Logged IP:

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

laurie 2008-07-27 03:15pm - laurie.woodsandsea@... - Logged IP:

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

petka 2009-12-09 12:25am - pol@... - Logged IP:

Reverse MySQL hashed passwords.

Petka 2010-01-13 11:28am - No Email - Logged IP:
rie 2010-03-31 09:19pm - No Email - Logged IP:

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