The show was filmed in North Carolina and based on Andy Griffith's hometown of Mount Airy, correct? ABSOLUTELY!
It never ceases to amaze me how many people I read about on the internet that say, "I just visited the REAL Mayberry - Mount Airy, North Carolina, and it was just like in the show!!" Well, sorry to burst your fantasy bubble, but you didn't visit Mayberry.
"Mayberry" was a fictional town created by Sheldon Leonard and the writers of the Andy Griffith show. In fact, Sheldon Leonard didn't even want the show to be in North Carolina, he just wanted it to be an example of a small southern town but Andy Griffith was able to convince him that placing it in North Carolina would align better with the comedic persona of his comedy albums. You can hear him talking about it here.
So, yes, it is true that Andy grew up in Mount Airy, and during the run of the show it's possible that he may have based a person or two on someone he knew personally, but the TV town of Mayberry was not a "stand-in" for Mount Airy.
Despite what the tourist guides may tell you, none of the show was filmed in North Carolina, Mount Airy or otherwise. The show was filmed entirely in California. The exterior shots of the overall town, the streets, the stores and homes were filmed on the Desilu Studios "40 Acres" backlot.
And that heart-warming scene at the beginning of each episode where Andy and Opie are walking to the "fishin' hole," that was filmed in Franklin Canyon Reservoir Park, located in Beverly Hills. The song is called "The Fishin' Hole," and you can hear Andy Griffith singing it by clicking here.