learn your lesson
learn (one's) lesson
To learn through painful experience not to do something, often something one had been warned about or knew might be risky. I told you that you'd feel awful if you drank that much wine. I hope you've learned your lesson. I certainly learned my lesson about buying something from a stranger online.