expression, godan verb (-ru)
learn a lesson; be good for someone
Typically used when an unpleasant or difficult experience serves as a valuable lesson or beneficial medicine for personal growth. Often implies that the experience, though tough, will ultimately be good for the person.
失敗はいい薬になるから、あまり気にしないで。
Failure is a good lesson, so don't worry too much about it.
厳しい指導が彼には
The strict guidance turned out to be good for him.