Two additional things to try if you don't have access to an external keyboard:
No external keyboard available, and you don't have a firmware password enabled:
1. Boot in recovery mode (hold command + r) while booting.
2. Select your language
3. Go to utilities (on the top menu bar), then select Terminal.
4. In terminal, type RESETPASSWORD and click enter
5. Select your hard drive/user name, then change your password to something all caps.
6. Follow steps 1-6 in the original reply, except you won't need to use an external keyboard (just use your new password when logging in).
No external keyboard available, firmware password is enabled:
*This may not work if your guest account boots into Safari only mode
1. Hold the Option button down on boot to bypass the Safe Mode ensure a normal boot
2. Take note of what your main login name is.
3. Log into the guest account, which shouldn't require a password.
4. Use safari to google "mac change password from terminal"
5. Go to the option reading "Terminal 101: Changing your Password with Passed"
6. Highlight one of the two lines of text beginning with "launchctl" (depending on your operating system). Then click Edit > Copy in the top menu bar.
7. Launch terminal (Finder > Applications > Utilities > Terminal)
8. Click Edit > Paste to paste the "launchctl" code, then click enter.
9. Go back to safari, and highlight "dscl . passwd /Users/", then click Edit > Paste (leave off username).
10. Type the first letter of your Username, then click the tab button. This should auto-complete your user name. Delete the final / after your user name, then click enter. NOTE: if the first letter of your user name is lowercase, you'll have to copy and paste it into terminal like the previous code (just find a lowercase letter on the web and copy and paste it in before hitting tab).
11. Enter a new password (in all capitals of course). As you type, you won't see anything appear on the screen, so keep it short so you know for sure what you are typing.
12. You will now be asked to type your old password. Go back to safari, and google "online qwerty keyboard"
13. Use an online clickable keyboard to type out your old password. Then highlight it, and click Edit > Copy.
14. Go back to terminal, and click Edit > Paste. Nothing will appear, but that's ok. Then click enter.
15. Your password should now be updated. Now following steps 1-6 in the original reply above, except using your new password instead of an internal keyboard.