Answer: The oxidation number of magnesium in magnesium chloride is +2.
Step-by-step explanation:
Oxidation number is defined as the number that is assigned to an element when it gains or looses electrons. If an element gains electron, it will attain a negative oxidation number and if an element looses electron, it will attain a positive oxidation number.
The chemical formula for magnesium chloride is

We take the oxidation state of magnesium atom be 'x'.
Oxidation state of chlorine atom = -1
Evaluating the oxidation number of magnesium atom:

Hence, the oxidation number of magnesium in the given compound is +2.