In this paper, ZnO‐containing coatings were prepared on the surface of AZ31B magnesium alloy by a simple one‐step micro‐arc oxidation method using zinc gluconate as the zinc source. The microstructure, elemental distribution, phase composition and chemical composition of the coatings were analyzed by scanning electron microscopy (SEM), energy spectrometry (EDS), X‐ray diffractometry (XRD) and X‐ray photoelectron spectroscopy (XPS), potentiodynamic polarization tests and electrochemical impedance spectroscopy were carried out in simulated body fluids to study the corrosion behavior of the coatings. The results show that introducing Zn2+ into the coatings reduces the number of pores and changes the microstructure of the coatings, resulting in improving corrosion resistance. In addition, the corrosion current density of the coatings prepared by adding 6 g/L of zinc gluconate was approximately two orders of magnitude lower than that of the coatings prepared without adding zinc gluconate.