All doors lock automatically when the lock side is pressed. They unlock when the unlock side is pressed.
Driver's door

Front passenger's door

To lock all the doors from an open front door, press the lock side of the door lock switch and then close the door.
NOTE
When locking the doors this way, be careful not to leave the key inside the vehicle.
Locking, Unlocking with Transmitter
Auto Lock/Unlock FunctionMazda 6 Owners Manual: Cargo compartment light switch inspection
1. Remove the liftgate lower trim. (See LIFTGATE LOWER TRIM
REMOVAL/INSTALLATION)
2. Disconnect the cargo compartment light switch connector.
3. Inspect for continuity between the cargo compartment light switch
terminals using an ohmmeter.
If not as specified, replace the liftgate lock.
...
Mazda 6 Owners Manual: Shift-Lock Override
If the selector lever will not move from P using the proper shift procedure,
continue to hold down the brake pedal.
1. Remove the shift-lock override cover using a cloth-wrapped flat head screwdriver.
2. Insert a screwdriver and push it down.
3. Press and hold the lock-release button.
4. Mov ...