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;
All content licensed under the Creative Commons License