Restart the Mac.
Right after you hear the chime, press and hold the Command and the R keys for a few seconds, then release.
When booting is complete, you'll see a window of "OS X Utilities." You won't do anything there. Instead, you'll go to the Menu bar at the top and select Utilities > Terminal. In the terminal window type the following and hit the Return key.
A new window will open.
Click on Macintosh HD and select the desired user account in the popup. Then enter the new password ***** A password ***** is optional. Click "Save."
Go back to the Apple Menu at the top. Select OS X Utilities > Quit OS X Utilities. That will prompt you to restart the Mac.
If all went well, when the Mac restarts normally, you'll be able to log in to the administrator account with the new password ***** defined.