Let me start by confessing that when I write a story, I tend to make cameos within the narrative. I don't always function as the main character, but I am there, keeping an eye on the inhabitants of my mini universes. I could be anyone from the work-stressed sister on the other end of the phone to the blue-haired (yep, my a hair's been that color more than once) background character who's actions are a catalyst of sorts, but it's a habit now for me to be there in some capacity. I believe that there is nothing wrong with that in the least bit. In one of my current projects, my main character basically is me, tweaked of course, and with several differences, but she is me, exploring a world I made up. I'll restate that there's nothing wrong with this.
Oh yes, until. This word just makes me giddy with anticipation, because it means I'm about to fully analyze and critique something. (Favorite hobby, seriously.) Okay, I'm back now.
It's fine to stick yourself in your story. If you want your main character to be a variant of you, that's fine, but watch out for Mary Sues and Gary Stus. They tend to be rampant in fanfiction, but I have also caught them lurking in books that I've purchased. (Yes, there are different degrees of Sue and Stu, and the pair is quite sneaky. They're like glamor ninjas.) The most blatant type of Mary Sue tends to occur when the author inserts herself as the powerful and extremely beautiful main character. Gary over here shows up in the same way. Usually, they're pretty average height (a 21st century type of average, regardless of the era they live in) and either have something inexplicable about them (abilities or appearance), and they never live an average life. If they are not a princess/prince, then they are a beggar who is really a princess/prince and life is hard. Abuse is common for Mary and Gary. Sobsob, crycry. Writers, avoid this at all costs.
When you decide to make your main character a version of you, do so in personality. If he or she looks like you, fine. Having a picture of a character in your head for reference is a great idea. It helps you visualize actions that they or other characters make, see someone's face as they speak, and understand how the character would move if they walk, run, swing a sword, or drive a car. But a mistake that some writers make is going out of their way to describe the character, pointing out Mary or Gary's eye color or hair sheen or unblemished skin constantly. Usually, when you flip to the author's picture, you'll find that they are the spitting image of their perfect main character. (Feather, which I reviewed earlier, has the dubious honor of being exactly like this. I do not exaggerate when I say that Estella describes herself every few pages. It gets old reading about someone being perfect in looks.) I know that as far as the Twilight Saga goes, many people either love it to obsession or hate it with a passion, but the lack of self-description was actually something that impressed me. There's a little bit of description, but it's in context as to where the character lives at the beginning of the story. Actually, you never get a clear grasp on what Bella looks like until the fourth book, when one of the Cullen sisters remarks on the color of Bella's eyes when she was human. Nicely done. Yeah, she looks like the author, but does not ever come across as "I'm perfect in every external way." Also, if you have an evil character, please refrain from making them look like the slightly petty, mean, and popular girl in your school. Female villains tend to be slightly perfect as well, and that's just as annoying.
Give your character flaws. And I don't mean "they're a worrier" or "they get stressed easily." I mean give them real flaws. They're scared, or they have acne. (Glasses, by the way, are hardly a cosmetic problem. Yeah, I wear contacts now, but mostly out of convenience. For me, they're easier to maintain. If they were harder to own, I'd totally have glasses.) Maybe they're mean sometimes, even to their best friend, or *gasp* they can't use a sword with any competence whatsoever. You have to be careful, though, of making your main character unlikeable. Let them have flaws, but normal, human, every day flaws. Characters who are unpopular in school because "popular kids are mean" are not realistic. (I went to private school for 13 years. I wasn't exactly Homecoming Queen, but I wasn't ridiculed for stupid stuff like having curly hair or wearing knee socks with my skirts. Actually, high school was rather nice.) That's one of the things I liked in the Harry Potter series. Harry can be an awkward guy, but he has friends. Yeah, he has enemies, and he's not super popular at Hogwarts, but he has a good circle of people who like him, and with whom he hangs out. Most of the ones who don't like him feel that way because they are actual foes with an agenda. (Poor Snape and his unrequited love for Lily, though.) Without the list of mortal enemies, it's a convincing story of adolescence. Okay, J.K. Rowling hardly put herself into that story, but you see the point. Don't make your story into a pity party about your life if your life is pretty average and pretty good. (Okay, the Dursleys were mean, but jealousy fueled it, and the 90s were a grungier time anyway.)
You don't always have to be the main character. Remember, there is an Academy Award for Best Supporting Actor. Let yourself be an observer, or a background character. You could be the main character's best friend, helping them decide stuff. But most writers will choose to make the main character another version of themselves, and that's fine as long as the character is convincingly imperfect, just like you. It can be hard to build a character that everyone can relate to, but if you're willing to actually work on a character instead of taking the lazy route and making them perfect/powerful/the Chosen One, you and your readers will be rewarded.