Your computer's Administrator account allows you to manage system settings and alter the filesystem. Regardless of the operating system you're using, you can modify the administrator account password through the command line interface. In Windows, the Administrator account is typically disabled by default and must be enabled before use.
Steps
Windows

Understanding Different Types of Administrator Accounts: Windows automatically creates a disabled Administrator account in all versions post Windows XP. This account remains disabled for security purposes, as the first personal account you create is automatically an administrator. The method outlined below will guide you through enabling the disabled Administrator account and then setting a password for it.

Press the Windows key and type 'cmd'. You should see 'Command Prompt' appear in the search results.

Right-click on 'Command Prompt' and choose 'Run as administrator'.

Type net user administrator /active:yes and press Enter. This action will enable the Administrator account on your computer. Activating the Administrator account is often done to streamline automation tasks without encountering User Access Control prompts frequently.

Type net user administrator * and press Enter. This allows you to reset the Administrator password.

Enter your desired password. Characters will not be visible as you type. Press Enter after inputting the password.

Confirm the password by retyping it. If the passwords don't match, you'll need to try again.

Type net user administrator /active:no and press Enter. This action will deactivate the Administrator account. It's advisable to disable the Administrator account when it's not in use. After setting your password and completing necessary tasks as the Administrator, deactivate it using Command Prompt.
macOS

Understand the procedure. You can utilize Single User Mode to reset your Mac's administrator password if you've forgotten it. Administrator access isn't required to execute this process.

Restart the computer and hold ⌘ Command+S. Continuing to hold these keys during startup will bring you to the command line.

Execute fsck -fy and press Return. This action will scan your hard drive for errors, which may take a few minutes. It's necessary to proceed.

Execute mount -uw / and press Return. This grants you permission to make changes to the filesystem.

Execute passwd Administrator and press Return. You can modify the password for any user account by replacing 'Administrator' with the user account name.

Input your new password twice. You'll need to enter your new password and then re-enter it to confirm. The password won't be visible as you type.

Execute reboot and press Return. This action will restart your computer and load OS X normally. Your Administrator account will now utilize the updated password.
Linux

Assess the risks before proceeding. Linux is designed to allow you to perform administrative tasks without logging in as the root user. It's advisable to use the sudo command instead of logging in as root. Since sudo can be used with your own user password to make root changes, setting a root password is not essential. If you still wish to proceed, continue reading.

Launch the Terminal. You'll modify the password via the Terminal, accessible from the taskbar or by pressing Ctrl+Alt+T.

Type sudo passwd and press Enter. You'll be prompted to enter your user password.

Set your new root password. After inputting your user password, you'll create the new root password. You'll need to input it twice for confirmation. The password characters won't be visible as you type.