One of my Macs I use as a bastion server for remote access, but the night before I left for a trip, I discovered that I had forgotten the admin password. I certainly did not have time to reinstall and reconfigure, so I wanted a quick fix.
The following applies to Mac OS X Snow Leopard; I don’t know if Lion behaves the same way. It worked great for me.
Your first option
Booting off a system DVD provides a “Reset Password” facility, but I had no bootable DVD for Snow Leopard (my disk was apparently damaged and would not boot).
Creating a new admin account in order to reset existing passwords
You will need to use Terminal in single-user mode.
1. Reboot, holding down cmd-S right as soon as the Mac makes its reboot chime. This boots into single-user mode.
2. At the text prompt (Terminal command line), enter these commands (you can copy and paste them from here):
mount -uw / rm /var/db/.AppleSetupDone shutdown -h now
3. Start up the Mac; it has reverted to the state as if it had not been used yet, like a brand-new installation.
At this point, you will need to create a temporary admin account. Create an account “temp”, login to “temp”, then change the password(s) on any existing account(s).
Finally, logout, then login as your preferred (prior) administrative account, and delete the “temp” account that you just created.