The invention relates to a magnesium alloy micro-arc oxidation electrolyte and a micro-arc oxidation method. The electrolyte comprises phytate (or phytic acid), a calcic electrolyte, and further one or more added electrolytes as follows: carbonate, silicate, boric acid or borate, and aluminate or aluminum hydroxide. The micro-arc oxidation method comprises the following steps of: pre-treatment; micro-arc oxidation; and post-treatment. The micro-arc oxidation electrolyte provided by the invention does not contain Cr<6+>, F<-> and PO4<3->, and even if strong base used is less, so that the environment is not polluted. The film obtained by the micro-arc oxidation method is smooth in surface, good in corrosion resistance and better in antibacterial performance and biological activity. According to the method, raw materials are easily available, and the method is suitable for industrialized production.