teach a lesson
teach a lesson {v. phr.}
To show that bad behavior can be harmful.
When Johnny pulled Mary's hair, she taught him a lesson by breaking his toy boat.
The burns Tommy got from playing with matches taught him a lesson.
Categories:
Source: A Dictionary of American Idioms