The local structures of Zn$_{1-x}$Mg$_x$O alloys have been studied by Raman spectroscopy and by synchrotron x-ray pair distribution function (PDF) analysis. Within the solid solution range ($0leq{x}leq{0.15}$) of Zn$_{1-x}$Mg$_x$O, the wurtzite framework is maintained with Mg homogeneously distributed throughout the wurtzite lattice. The $E_2^mathrm{high}$ Raman line of Zn$_{1-x}$Mg$_x$O displays systematic changes in response to the evolution of the crystal lattice upon the Mg-substitution. The red-shift and broadening of the $E_2^mathrm{high}$ mode are explained by the expansion of hexagonal $ab$-dimensions, and compositional disorder of Zn/Mg, respectively. Synchrotron x-ray PDF analyses of Zn$_{1-x}$Mg$_x$O reveal that the Mg atoms have a slightly reduced wurtzite parameter $u$ and more regular tetrahedral bond distances than the Zn atoms. For both Zn and Mg, the internal tetrahedral geometries are independent of the alloy composition.