Do you backup your iPhone to your Mac? I recommend that you manually backup your iPhone to your Mac, every few weeks, even if you already backup your iPhone automatically to iCloud. When you backup your iPhone to your Mac you have the choice to encrypt the backup or not. The advantage of encrypting your iPhone backup is that the backup will include information not stored in an unencrypted backup such as email account passwords, wi-fi settings and health data. There are 2 significant disadvantages of forgetting the password used to encrypt your iPhone backup. First, you cannot restore that backup onto your iPhone. Second, it was very difficult to work-around the forgotten backup and create a new backup of your iPhone on your Mac. Finally, starting with iOS 11, Apple introduced an easy way to work-around a forgotten iPhone backup encryption password.
Read Apple’s support article about encrypted iPhone backups and focus on the section about forgotten passwords. This section describes the reset procedure that Apple added to iOS 11 and above. After resetting your iPhone’s backup encryption password then it’s easy to perform a new backup of your iPhone to your Mac. You can choose to either encrypt this backup or not.