The invention relates to a
corrosion inhibitor and a preparation method thereof. The
corrosion inhibitor comprises, by weight: 50-70% of
Mannich base, 10-20% of
phosphate, 10-20% of isopropanol, and 10-20% of
sodium molybdate. The preparation method of the
corrosion inhibitor comprises: adding N-
methylaniline into a three-neck flask, heating the flask to 80 DEG C, and adjusting the pH value to 2 with concentrated
hydrochloric acid; heating the flask to 95 DEG C, adding
acetone into the flask, and heating the flask to 150 DEG C; adding
formaldehyde and
benzaldehyde into the flask, maintaining the temperature at 150 DEG C, and performing
reflux for 4h while performing stirring to obtain
Mannich base; and compounding, by weight, 50-70% of
Mannich base, 10-20% of
phosphate, 10-20% of isopropanol, and 10-20% of
sodium molybdate to prepare the
corrosion inhibitor. The
corrosion inhibitor can be used at a high temperature of 180 DEG C. When the concentration of the
corrosion inhibitor is 100 ppm, an N80 iron sheet is corroded by stratum water of the Tahe Oilfield for 6h at 180 DEG C, and the corrosion inhibition rate is 90.04%.