The invention provides a corrosion inhibitor for inhibiting corrosion of magnesium alloy in automobile cooling liquid. The corrosion inhibitor consists of specific adsorption organic substance or/and film-forming inorganic substance, and water or/and ethanol. The corrosion inhibitor is a compound efficient anti-scale corrosion inhibitor, can well inhibit the corrosion of a magnesium alloy material in the cooling liquid in a wider temperature range, and has the characteristics of wide application range, low using amount, high efficiency, no toxicity or peculiar smell, full water dissolution, simple and convenient preparation, low cost, wide applicable temperature range, strong synergistic effect, convenient use, good comprehensive performance and the like. 100 to 1,000ppm corrosion inhibitor directly added into the automobile cooling liquid can inhibit the corrosion of the magnesium alloy, effectively inhibit the corrosion of the magnesium alloy material in the automobile cooling liquid at a normal temperature and a high temperature, and effectively protect the magnesium alloy.