Some research shows that taking magnesium tablets (usually magnesium oxide) once a day can help to prevent menstrual-related migraines. The recommended dosage, if you tend to get migraines around your period, is 400 to 500 milligrams a day.