 Mayr was the son of a magistrate.After graduating from high school, he was enrolled on 14 July 1901 in the 1st Bavarian Infantry Regiment in Munich as a cadet.Well regarded by his superiors, he made rapid progress, becoming "Leutnant" in 1903 and "Oberleutnant" in 1911.