remind him:
Love yourself, you need to take care of that "self", which is separate from your consciousness.
Value yourself, you are worthy of the time that is needed to solve the problem at hand, no need to rush and don't let anyone rush you.
Take a deep breath.
Think, focus your energy on thinking, do not distract yourself with emotions, do not abandon the fort.
Break the problem down into smaller pieces or steps, that requires thinking.
By failing after a try, you might learn something, try again with some adjustment.
(Be sure the problem is not too hard for his age. Give him ample time. Reasonable efforts build confidence over time. If he crashes, say with a smile: Take it back, let's try again.)