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;


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 3.137.218.230
To prevent spam please submit by clicking the kitten: