Green’s Dictionary of Slang

school of hard knocks n.

also college of hard knocks, university…, school of hard fact

[late 19C+] (orig. US) a hard life, seen as a means of education.