Passwords for all user accounts can be reset and changed when booted from the Recovery Partition on OS X.
This tutorial can be used for OS X 10.11 El Capitan, OS X 10.10 Yosemite, OS X 10.9 Mavericks and OS X 10.8 Mountain Lion.
Step 1. Boot into Recovery Partition
When booting starts press command + R and hold until you see startup screen
Step 2. Go to Utilies>Terminal
Step 3. Insert command “resetpassword” and hit enter (For those that cannot see hard drive insert command “mount –uw /” first)
Step 4. On Reset password screen, select the volume hard drive and user account that you need to reset password. Type 2 times new password and hint and press Save.
You will get confirmation screen and details about the keychain account.
This procedure don’t reset Keychain password, you will need old password to open it or to create new one.