Magnesium: You can try to take Magnesium Supplements to get relief from a headache. It is an important mineral for muscle and nerve function, and deficiencies can lead to headaches. You can also try to increase your magnesium intake by eating magnesium-rich foods like almonds, spinach, and pumpkin seeds