I used to get it regularly when i was on the pill years ago - I started taking a probiotic from the start of AF till it finished and this worked for me.

I just used to buy either acidopholus capsules (about $10 a bottle) or something like Inner Health Plus (about $30 but probably stronger/more effective) - worked a treat, never had a problem with it again.