Semiconductor materials, as the core of the new generation of information technology, and nano ZnO as the third-generation semiconductor, have high absorption and transparency in the visible light range, as well as a wide bandgap, making it widely applicable in the field of optoelectronic components. This article prepared Mg-doped ZnO nanorods using a low-temperature water bath method and studied the effect of Mg doping on the structure and luminescent properties of the samples using scanning electron microscopy (SEM), X-ray diffraction (XRD), and photoluminescence (PL) analysis. The SEM results indicate that the obtained sample has a double-columnar ZnO nanorod structure. As the Mg doping concentration increases, the size of ZnO nanorods first increases and then decreases. When the Mg doping concentration reaches 2%, the size of ZnO nanorods reaches its maximum, about 7.94 μm. The XRD results indicate that the obtained ZnO sample has a hexagonal wurtzite structure, and there is no additional Mg impurity phase in the sample, indicating that Mg2+ has successfully replaced Zn2+ into the lattice. The PL spectrum indicates that the obtained sample has a maximum UV emission value of around 395 nm and exhibits green (520 nm, 566 nm) and orange (600 nm) luminescence characteristics. With the increase of Mg doping concentration, the UV emission peak strengthens and shifts red, and the visible emission peak weakens, which improves the photocatalytic performance of ZnO nanorods.