Locks and lights

I have an 09 mazda5. My power locks wont work and I have no headlights. Ive checked the fuses cant find any bad ones. When I press the lock on the door I hear a clicking coming from under the dash in a black box that has wires going into it. Please help. Thank you
2013 Mazda 5 Sport
Sounds like you have bad relay in the fuse box (engine bay). Just look on the fuse cover box which relay covers your locks and headlights. There should be several identical relays in there. A quick test would be to swap with a known good relay and see if your lights and lock will be working. Replacements should be readily available in your local autoparts store.