Boot your machine up while holding down the Command and "S" keys. This should take you to single user mode. Type in the following lines and press enter:
/sbin/mount -uw /
launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist
Now you can change the user's password. For example, if the user was called awesomeman, you would type in:
It will then prompt you to enter the new password twice. Once finished, just reboot your machine:
shutdown -r now
That's it! You should now be able to boot up and log in with the new password.