Some tips from my own experience:
1. Focus more on all the positive things that will happen when you succeed than thinking of all the bad things that will happen if you dont. It's easy to imagine all kinds of worst case scenarios, especially when your plagued by a a little doubt. Try to have faith and power through
2. Exercise! Trite as it might sound exercise is really important for mental well being and can lift your spirits if you're feeling down
3. Surround yourself with people that give you energy. Now I'm not saying you should only socialize with sycophants and yay-sayers but some people can be a real drain on a persons motivation.
4. Embrace "the fear". So things are hard, you're not sure you going succeed. On the other hand, you can probably look back at similar times in your life which now seems like exciting learning experiences. Realize that you're in the middle of one of those and chose be excited about it.
4. Don't let other people bring you down. Those who says it can't be done should get out of the way of those who are doing it. Some good ideas are only evident in hindsight so don't listen too much to the naysayers.
5. Get some perspective, even if things can seem bad and insurmountable I'm sure we all can imagine people who do everything for the same oppurtunity or people with far worse problems.
6. Adopt an attitude of every mistake being an learning opportunity. Don't be angry at yourself for making them. Be glad that it didn't take you longer to find out your mistake and glad that youre wiser for it