If you are living in your own head while playing music, you're going to make lots of mistakes. Learn to loosen up and play the music without thinking so much.
This is why I am grateful that I learned how to play by analyzing patterns and hearing intervals. I can't imagine the struggle it would be if I had to be in my head all the time thinking about each note before I play it. Oh, it's a C. Where's the octave C? Things like that.
I know part of it is a function of time spent playing, but I couldn't tell you what note I just played unless I sat there for a moment or two and thought back over what I just did. The goal is to get to a place where you aren't putting a barrier between wanting to do something and actually doing it - and thinking about your notes is that barrier.
Keep playing, and observe how certain things always work the same. You can always find the major third one string over and one fret down. You can always find the fifth one string over and two frets up. Work on training your muscle memory to go where it needs to go when you hear those intervals (or see them written). Nobody needs to laboriously chant "G - D" when playing R-5, that's unnecessary information that's just clogging up the space between your head and your fingers.
Maybe you don't do that, but the point I'm making is that we make more mistakes when we're caught up in our own heads and not in the flow of the moment. Getting into that state of flow, where your instrument becomes an extension of you, will allow you to play what you want to play with less effort. I'm not saying it's not important to know where your notes are, but that is information that helps you sort out where you are in terms of key, and where to go if you're getting lost, etc. As a beginner you think about it quite a lot, but a goal should really be to get away from thinking about it.
As I said earlier to someone, I also make more mistakes when I lose focus and my mind wanders. The trick to keeping focus is to keep your mind out of the way. Sounds ironic, doesn't it? Don't think so much about what you're doing, just focus on the doing itself. Don't think about what you're going to make for dinner, just keep your mind where your intention is and let the music come. This takes a bit of practice.
I work with a drummer who used to be very stiff and rigid. His tempos were also really off the mark. I told him he needs to learn how to relax into the beat and get out of his own head when he's playing. After a year and some change of working at this, that guy is a much better drummer and his tempos are rock solid. I watched that guy take a giant leap out of the kiddie pool and into the deep end, and he's so much happier. He's also getting a lot more work. So just keep at it, but relax and find your place inside the music. The music isn't coming from you. The music is in you - you are a part of what brings it to life.
Having said that, you'll still make mistakes. Perfection is a questionable goal because you'll never be happy with yourself, since no one is ever perfect. A better goal is to strive for excellence, knowing you'll sometimes fall short of your ideal. Learning to accept and recover from your mistakes will make you a more valuable player and it will make you someone others want to be around.
I do not want to hear my bandmates complaining about their mistakes; it brings me down to have that negativity coming out of them. I want to hear them happy about all the things they did right, and coming in next time with those minor problems worked out- which shows me they heard it and fixed it.
Think about how many notes you play at a rehearsal. In all of that, how many bad notes do you play? Why focus on the small number of bad notes when you could be happy about everything else? That's not to say you don't notice in order to improve, but there's no need to beat yourself up.
On gig day I want to see everyone having fun, and leaving those inevitable mistakes right in that space where they were made. Dwelling on your imperfections and always being negative about the way you've played is not going to make you or your bandmates happy.
Hope all this makes sense. I think some of it won't make sense completely until you experience it.