I’ve used a simple fix for this problem on other make vehicles, but not yet on my new Mazda. However, I don’t see why it shouldn’t work with practically any vehicle .
The primary issue is that when the 12 volt power supply from your car battery is interrupted, everything in your vehicle’s volatile memory disappears. The simple solution is to make sure your electrical system “sees” a continuous 12 volt supply.
A small 12 volt battery, or even a 12 volt DC power adapter, connected as a slave in parallel with your car’s battery leads, will suffice. (That is, positive lead to positive lead and negative to negative.) I use alligator clips to attach the leads. Note: You must connect the slave before you remove the old car battery.
The slave doesn’t have to be another car battery, although I suppose it could be. The effective load is minuscule -- you just need enough to power the volatile memory -- so the slave battery can be quite small.
Honestly, smaller is better for safety reasons: accidentally touch together positive and negative leads on a small slave battery and you’ll get a spark. Do that with a slave car battery and it’ll likely ruin your day.
As long as you never break the physical connection of the slave battery to your car’s battery leads until the new battery is installed, the volatile memory should intact.
If anyone knows for sure that this won’t work on a Mazda, I’d appreciate some clarification on what I got wrong. Always ready to learn something new.