School sometimes reinforces the idea that mistakes are bad. Instead, focus on how mistakes are part of the learning process and that this is particularly true in programming. Explain that when professional programmers write code, it rarely works the first time and that the most important thing is continuing to try things even if they don’t work at first. Give examples of the errors that students might see to help them decode the error message. Explain that nothing they do will damage the computer.
Example: "Even for professional programmers, programs never work at first!"
See this and related tips as a Tip Sheet: http://csteachingtips.org/Tips-for-introducing-computing