Meaning of “learn your lesson” - Learner’s Dictionary

learn your lesson

to decide not to do something again because it has caused you problems in the past:

I'm not going out without my umbrella again - I've learnt my lesson!

(Definition of “learn your lesson” from the Cambridge Learner’s Dictionary © Cambridge University Press)