How can I upgrade Mac OS without the administrator password?
You can boot from installation media and use that to reset your password. To do this:


Boot from installation media, or, if the Mac OS version is recent enough, from internet recovery.
Once in the installer, Utilities --> Reset Password will allow you to reset the password of the administrator user.


See this link for more information, including instructions on how to perform the reset without an installation disk.

Once the password is reset, you can perform an OS upgrade. Of course, as this is a second-hand machine, you may be better off doing a reinstall (in which case, just reinstall and don't bother resetting the administrator password first).