You're too tense. If you own a full body mirror in your hall, or house, use that. Check that you:
1. Don't raise your shoulders the slightest just before starting to play. Relax and let it all hang out. Down. As much "down" as possible. I used to do that. It hampered everything!
2. Check in the mirror picture that you don't undeliberately BEND the strings. Some I know use false grip and bend the strings out of tune. Very hard to hear on bass since it hasn't any chords in it. It's just one note at a time mostly.
3. As others have said, try to play without the thumb behind your neck. Very very good practice.
4. See how much you NEED to press down. As fast as it starts to buzz, you're too light, and if it goes out of tune (check with a tuner) you're pressing too much. It's very easy to press the fretted note out of tune. Ever seen/heard of those capos that - when put on a guitar - it goes out of tune? Way too much downward pressure. Needs to be adjusted. Same with fingers...
5. Relax, breathe, you're too anxious, and hyped up to be start playing. Even if it's in a positive vibe so to speak. You're glad that you're about to play...
6. Take time to prepare, and take LOTS of breaks.
If it still hurts, TAKE A LONG REST. A week or two doesn't do any damage. Instead It heals. As fast as you feel pain, stop. If you try to cope and stand the pain, it will get even worse and you will never be able to play again. Ask acoustic guitar legend Leo Kottke what happened to him. Yngwie Malmsteen too. Watch late videos of guitar virtuoso Steve Morse, he has now a "cast" on his picking hand. In spite of he's known for warming up excercises and precision to every lick he plays, and thorough technique. Now, he's suffering from RSI, due to that he has not ever never stopped playing. Even in his car, while driving, and when he was an airline pilot. No matter how meticulous you study, and honing your technique for not getting hurt, eventually in the end, the hurt shows up just because you've played too much, even if you play the academically and scientific proper way.