The trim is designed to pop off if the airbag deploys so it is held on with a little umbilical chord to stop it hitting you in the face. This picture shows you what it looks like off.
Mazda recommend that it isn't reused so if you follow their instruction to go and buy a new one. Getting it off without cutting it is very fiddly but can be done.
Pull the seal back from the door frame.
Get hold of the trim right at the top and pull it away from the frame towards the inside of the car. It is stiff but it will pop off.
Now hold or prop the trim out away from the frame so you can see up. You will see the little strap stretched out.
Look at the above photo. The part with the blue arrow is clipped into the frame. You need to get the two little clips fee from the frame and it isn't easy. I use a very small electricians screwdriver to push between the clip and the frame. That puts outward pressure on the clip. I then use a right angled pick to go inside the clip and tease those legs inward. If you are patient, the legs will pop out.
Once you fee the strap, the whole trim just lifts back out of the dash.
If you use a new clip or are ready to put the old one back, make sure the strap is hooked into the trim then push it back down into the dash. You can either completely assemble the clip so that it is all one or you can do the reverse of what you did to get it out. Putting it back is easy.
Warning, when you run wires down the window fram, make absolutely sure they are clipped above the airbag like this.
The photo is from a CX-3 which is nearly the same. The genuine CX-5 mirror plugs into the wiring plug near the bottom.