I just did this yesterday. What I did was:
- Create a new administrator account. In order to do this, I had to
boot the Mac into Single User Mode by holding down Command-S as I
restart the Mac. You release the keys when the white text appears on
a black screen. (I did not have File-Vault on.)
When the white text stopped moving, I entered these commands in order:
- mount -uw /
- rm /var/db/.AppleSetupDone
The Mac should restart immediately after typing the reboot command. Setup Assistant then appears.
- Go through setup again (don't worry, it's not changing anything already there or your other user accounts.) When you are prompted to transfer data, Choose NOT to; this will permit you to create a new administrator account on the next screen.
- Use a name that helps you distinguish this temporary Admin account from your real account.
- When Setup is complete, You'll be logged into the new admin account.
You can rename your real macOS user account and home folder, which were named when the account was created. The name of both your macOS user account and the name of your home folder must both be the same!
- Open the Users folder on the startup disk. It contains the home folder for each user. I selected my hard drive in the left sidebar. If you don't have that showing, just click on Go > Go to Folder from the menu bar, then enter /Users.
- Rename your real account's home folder without using any spaces in the new name that you want. You'll be prompted for credentials, so enter the administrator name and password that you just created and used to log in. (If you're using file sharing to share the home folder, you won't be able to rename it until you stop sharing the folder.)
- Next, you rename your real account's account. Choose Apple () menu > System Preferences, then click Users & Groups. Click the little lock key in the lower left corner and enter the administrator name and password that you are logged in with. From the list of users on the left, Control-click your real account that you're renaming, then choose Advanced Options. Change the “Account name” field to match exactly the new name that you just gave to your real account's home folder. It should have no spaces. The account name also appears in the “Home directory” field, after /Users/. Change that account name to match the new name of the home folder.
- Restore admin priviledges to your real account by checking the box next to "Allow user to administer this computer".
- Click OK, then restart your Mac. Log in to your real renamed account, and go to Users and Groups preferences again. Click on the padlock and authenticate with your real account's credentials. Then verify that your old files and folders are visible and the account is working as expected.
You can delete the other Admin account now if you want to avoid confusion.
Credit: I used the following two articles to do the above, and most of the steps were copied using their verbiage:
Don't be rattled by the first link's question of not knowing her administrator's name. The steps in the answer will still work for fixing your problem because it fixed mine.