Powdery mildew (PM) significantly and negatively affects the yield and quality of melon (Cucumis melo L.) worldwide. Race 2F is the predominant physiological race of the pathogen Podosphaera xanthii in many regions. We used accessions PMR 6 (P1; resistant to PM) and M1-7 (P2; susceptible to PM) to analyze the inheritance of resistance to PM (race 2F). The ratio between resistant and susceptible individuals fits a Mendelian segregation ratio of 13:3 in a total of 256 F2 individuals and 1:1 in BC1P2. The resistance to PM in PMR 6 was governed by two genes: a dominant (AA) gene with an epistatic effect and a recessive gene (bb). Only individuals with aaBB or aaBb genotypes were susceptible to PM. Two powdery mildew-resistance loci, Pm2.1 and pm12.1, were mapped on chromosomes 2 and 12 by bulked segregant analysis and secondary mapping by QTL analysis with 18 markers. A new marker-assisted selection system to identify melon genotypes resistant or susceptible to PM was developed and tested in 93 melon accessions. Nucleotide diversity (π) and fixation index (Fst) for the two powdery mildew-resistance loci were estimated using resequencing data of 336 melons from three groups: Cucumis melo subsp. agrestis, Cucumis melo subsp. melo and the intermediate type. The lowest π was observed in C. melo ssp. agrestis, and the highest Fst value was between C. melo ssp. agrestis and C. melo ssp. melo. The findings provide a promising tool that can be used to accelerate breeding for durable resistance to PM.