For a metal to react with sodium hydroxide solution it's oxide must be amphoteric, not just basic. Alkaline earth metals are called that for a reason; except for beryllium the oxides are purely basic (and in fact moderate to strong in basic strength) in water, so sodium hydroxide won't make those metals react.
Magnesium, as a typical alkaline earth metal, can be made to react with acids displacing hydrogen, even when the "acid"acid" is a transition metal salt that hydrolyzes slightly like cupric sulfate.