hey xeomonk,
magnesium oxide is wrong, Magnesium has two valence electrons, therefore it will form a magnesium ion of Mg2+, while oxygen in group 6 will accept these two electrons and form O2- to result in both octet happy. Since the charge is already in a sense balanced, What do you think the formula will be?
as for the second part, your ions formula is right but you noticed the charge is not balanced, try again?
note that lets say sodium chloride, we don't often write the formula as Na+Cl- but rather NaCl, because the charge is understood and it is balanced.