Pure MgO, 1 and 10 at% Mg-doped ZnO layers were grown by atomic layer deposition technique onto (001)-oriented α-Al2O3 and GaN substrates. The structure and the microstructure of the deposited layers were studied by TEM in detail. The pure MgO layer starts to grow with epitaxy with (100)-type defects that transforms to random orientation. In the 10 at% Mg-doped samples epitaxial cubic MgO buffer layer forms at the interface. This buffer layer helps the ZnO to grow epitaxially in the case of α-Al2O3 substrate forming a ZnO/MgO/c-plane α-Al2O3 hetero-structure showing higher mobility with lower carrier concentration, while in the case on GaN substrate the ZnO is strongly textured. Consequently for higher concentration Mg doping (with the formation of MgO buffer layer) α-Al2O3 is better choice to grow epitaxial ZnO layer. The 1 at% Mg-doping of the epitaxial ZnO layer grown onto GaN substrate was successfully implemented, while in the case of α-Al2O3 substrate a thin cubic MgO buffer layer forms. This shows that the success of low concentration Mg doping in ZnO largely depends on the choice of substrate material as well.