On macOS Sierra (10.12.6).
Last week, an installed application (XAMPP) tried to access my keychain upon launch (which it always does), but (for reasons still unknown) the correct password was rejected. I didn't think much of it at the time; said to myself "probably had caps lock on/off and didn't realise" and it wasn't urgent.
Fast forward to this morning and I opened my MacBook, but my user login (again, the correct password) wasn't working. Retried several dozen times (making absolutely 100% sure it was correct) and nothing. I could log in as normal even a few hours before. After several panic-fuelled hours thinking I might lose everything, I regained access by using
resetpassword through the Terminal in Recovery Mode.
Then the keychain wasn't accessible with either my old password or my new one. As I understand, the keychain password and new user password were out of sync, but even the option to reset it through Keychain Access didn't work with either password.
Almost every application was asking for access and it failed. On one application (in frustration) I typed in a bunch of random characters (e.g. sdkj24fhsd) and, shockingly, it worked. After this, I made a new completely new keychain (with a new password), which gave me the option to go into Users & Groups and change my password, but (once again) my original password, reset password or reset keychain password did not work.
I'm honestly afraid to even let my Mac go to sleep or close the lid, for fear that the same user-login problem occurs and I might not be so lucky/lose access for good next time.
I don't want to take the nuclear option and have to factory reset my Mac just to resolve an issue with a utility I barely even use — though I'm starting to suspect it's somehow corrupt and is the root cause of all this.
Does anyone have advice on how to proceed from here?
Thanks in advance.