Crap, I’ve just forgotten my mysql root. I found a lot of way to restore password root of mysql. Well, in one side, it’s a good thing that we can recover our password again, in the other side I feel if it’s so easy to recover the root password, that means BIG HOLE.. isn’t it? Hmm, sometimes as DBA, we have to pick the double-edge sword to make it useful knowing the threats.
You can see a lot of method to change user’s password following this link.
You also can see a lot of method to recover root password. One of them is this source.
In the root password recovery process, I can’t start the mysqld_safe. It fails saying:
Starting mysqld daemon with databases from /var/lib/mysql STOPPING server from pid file /var/run/mysqld/mysqld.pid 070105 20:23:40 mysqld ended
The problem for this error log is that system can’t access /var/run/mysqld. So the solution I’ve found for this error is checking the ownership of /var/run/mysqld . You can change the ownership with chown to that folder and change the moderation if necessary.
Now I can execute :
mysqld_safe --skip-grant-tables &
And change the root password.. Voila..