What's the best way to deal with muscle cramps from exercise?

Magnesium. Magnesium is a mineral involved in over 400 different processes in the body. Among other things, magnesium allows muscles to achieve a neutral, relaxed state. Try magnesium oxide 250 or 400 mg tabs. Dosage will be the amount it takes to relieve muscle cramps without giving loose stools. The only side effect from magnesium, if you have normal kidneys, is diarrhea and then only if you take too much.
Minerals. You must have ample potassium, calcium, magnesium, sodium, manganese and zinc for muscles to contract and relax properly! if your diet is deficient in any one of these you may experience muscle cramping and or spasms! most people lack calcium and magnesium in their diet. Try supplementing and see what a difference it makes.