The inhibition behavior of the promising eco-friendly inhibitor 8-hydroxyquinoline (8HQ) in two concentrations of sodium chloride solution was studied by hydrogen evolution, scanning electron microscope (SEM), three-dimensional morphology, electrochemical testing, and computational calculations. The results indicated that the 8HQ inhibitor showed satisfactory inhibition effect due to its fast, excellent adsorption capacity and self-healing ability. The corrosion inhibition effect is related to the concentration of the inhibitor. There was a competitive adsorption relationship between 8HQ and [Cl−], and the adsorption morphology was obviously affected by the concentration of [Cl−]. At the lower concentration of NaCl solution, the adsorption of 8HQ was more orderly, faster, and the adsorption amount was larger, which led to the formation of a denser protective layer. Density functional theory (DFT) results showed that the most stable adsorption configuration of 8HQ was NO-Top. N and O atoms are the active sites, and there is a strong coupling between them and Mg atoms, which is consistent with the experimental results.