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

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

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

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@yahoo.com - Logged IP: 84.242.191.130

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

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

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