Three ways to recover a root user password:
The order of solutions here under gets more creative on the way down :)
1. obviously, before starting messing around check my.cnf or
scripts for passwords entries, then try home directories for
password files
2. secondly – can you restart mysql? if yes, restart with
–skip-grant-tables, log into mysql, change your password and
restart without –skip-grant-tables
3. third option – (on linux / unix ONLY)
If you haven’t found the password anywhere and can’t afford to
restart your mysql.
cd data/mysql cp -rp user.MYD bck_user.MYD_`date +%Y%m%d` cp -rp user.MYD /tmp/user.MYD vi /tmp/user.MYD #(edit the hashed passwords next to root*) cp -rp /tmp/user.MYD user.MYD sudo kill -HUP `pidof mysqld`
Note that the latter method of recovering a root password CAN be easily used maliciously leaving no trace! The only way to avoid such an attack is to make the …
[Read more]