I think gliscor is a good counter, cause it specializes in physical attacks. Here's a moveset for gliscor to stop mega mawile:
Gliscor@Toxic Orb
EVs: 252 Attack/Defense, 4 Hp
Trait: Poison Heal
Jolly nature
Moves:
Protect, just to get some health back
Fire Fang, super effective against mawile and you can get a burn/flinch hax :)
E-Quake, nuff said here
Facade, double damage, very powerful
Hope this helps!