You can also take magnesium chloride flakes as a supplement, either orally or transdermally. Mixed with water, it's called "magnesium oil", which is absorbed quite well through the skin. You put it in a spray bottle and spray it on.
A 2 lb bag is around $21 on Amazon:
2 Pounds Magnesium Chloride USP (Pharmaceutical Grade) 100% Edible "Greenway Biotech, Inc. Brand"
To take it orally:
"We recommend mixing 33 grams per 1 liter of water and take one shot (1.5 oz or 45 ml) of that a day if you're 51-70 years old, half a shot 10-50 years old and twice a day if you are over 71 years old."