by Luis de Vasconcelos.
An easier way is to use phpMyAdmin to copy the password hash from a profile that you do know the password for and update the profile whose password you need to change with that known password hash. e.g.:
SELECT password FROM mdl_user WHERE id = <the id of a moodle profile that you DO know the password for>;
UPDATE mdl_user SET password = <the password from above> WHERE id = <the id of the profile whose password you have forgotten>;
Then login to the profile with that password and change the password to something you won't forget...
I might be wrong, but I I don't think the password algorithm is a straight MD5 hash. I think it's a bit more complicated than that.