MgCl2 is an ionic compound. Magnesium is a metal with a positive charge of +2.