The aim of the present investigation was to run a protocol to detect mecA gene that characterizing methicillin-resistant Staphylococcus aureus (MRSA) using phenotypic and genotypic molecular techniques. Also, this study was designed to determine the prevalence of mecA-positive MRSA strains in milk and its surrounding milking environment from 60 dairy cattle houses including 30 for cows and 30 for buffalos. Therefore, 308 samples were collected including 150 samples from cows' houses and 158 from buffalos' houses. The samples from cows' houses were 30 milk samples (5 of them were mastitic), 30 air samples, 30 floor samples of different soil types, 30 tap water samples and 30 pail water samples. The samples from buffalos' houses were 38 milk samples (8 of them were mastitic), 30 air samples, 30 floor samples of different soil types, 30 tap water samples and 30 pail water samples. It was also recorded the floor type either muddy or dry and the rearing type either separate or mixed with farm animals. Thereafter, the collected samples were examined directly for identification of Staph. aureus and then MRSA using phenotypically and biochemically with API ID 32-STAPH. All the identified strains were tested genotypically for resistance to oxacillin by detection of the gene encoding methicillin-resistant that called mecA gene PBP2a (penicillin-binding protein) using PCR assay. The obtained results revealed that, 139 samples were positive for Staph. aureus including 75 samples were positive for MRSA which included 50 samples were found mecA-positive MRSA divided as 14 milk samples and 36 milking surrounding environmental samples. The mastitic milk samples of cows and buffalos were contaminated with mecA-positive MRSA in percentages of 60 and 37.5%, respectively. The statistical analysis results proved a significant correlation among the isolated strains in the milking surrounding environments of both dairy cows and buffalos; in which, a significant correlation between milk samples and also between soil and water in the cows' environment. With attention to the buffalos' environment, a significant correlation was found between clinically normal milk and both of air and water; also, a significant correlation among air, soil and water was noticed. According to the obtained results, the role of some ecological parameters on the distribution of mecA-positive MRSA strains was observed as a significant correlation between muddy floor and both types of rearing, and also between dry floor and mixed rearing in the milking surrounding environments of both dairy cows and buffalos.