Everyone has this thought. And it is a very good starting point.
If you try something, no matter what, you already achieved something. Forget failure, or whatever outcome. By trying you are achieving and trying is always enough. (Not that it should be a reason to keep on trying, but look around you: how many people keep on trying? And if f not, what life do they have?)
You can also be proud that you tried. You gave it, hopefully, your best shot. And when the result is not good enough, try again. Because every mistake teaches you something. About if you still want to achieve that goal, and it teaches you a lot about yourself.
The biggest failure is never trying again. In the end what counts is the courage to continue.