I think you may have overdosed a bit on magnesium and gotten out of balance.
I read it's important to keep a balance of calcium, magnesium and phosphorus at 2:1:1
Magnesium as a supplement doesnt have to be taken daily. Its better to take it every other day or once a week. Its also better in case of daily intake to spread it into 2 smaller parts to take at several times of the day instead of one big dose at a time.
I read that the book by dr Marianne Mousain-Bosc about magnesium is recommended reading.
Maybe you need to look into natural foods more that also contain calcium and phosphorus and not overdo on the magnesium.