Imported from the Apple Support Forums via the Wayback Machine 🔗
USE TIME MACHINE RESTORATION
Do you have a recent Time Machine to recover from?; one that you would recall the password you used for logging into?
If so, and you are certain there is no important data you will lose, then perform a Time Machine restoration in Recovery Mode (Upon Boot, hold Down Command + R simultaneously), and restore your Mac from a Time Machine backup.
Once logged in, change the password. Prior to doing so, create a hard copy of it, and store it in a safe, easy-to-remember location.