Due to high electrode potential, other products, rather than metal, are deposited at cathode. So, Mg cannot be obtained by electrolysis.
Take chapter-wise tests, track your progress, and master Metallurgy.