The St. Louis Cardinals selected Mayers in the third round of the 2013 Major League Baseball draft. He signed and made his professional debut with the GCL Cardinals before being promoted to the Peoria Chiefs, where he finished the season. In innings pitched between the two teams, he posted a 1–3 record and 2.97 ERA. He spent 2014 with the Palm Beach Cardinals, Springfield Cardinals, and Memphis Redbirds, compiling a combined 8–12 record, 3.39 ERA, and 1.37 WHIP in 26 starts between the two teams. In 2015, Mayers was 2–4 with an ERA of 5.87 for the GCL Cardinals and Springfield, and underwent surgery for thoracic outlet syndrome. Recovered from TOS, Mayers progressed through the two highest minor league levels in 2016. First, he pitched for Springfield, where he was a mid-season All-Star. Over nine starts for Springfield, Mayers was 5–2 with a 2.30 ERA. He was then promoted back to Memphis in May. The Cardinals selected Mayers' contract from Memphis on July 23, 2016, and announced that he would make his Major League Baseball debut the following day against the Los Angeles Dodgers on national television on ESPN's Sunday Night Baseball. He had a 3–3 record and 2.94 ERA over nine starts for Memphis prior to his promotion. In his debut, each of the first four batters he faced in the first inning reached base, and all scored on a grand slam by the fourth, first basemanAdrián González. In all, 10 of 14 batters reached base as Mayers surrendered nine earned runs, eight hits, and two walks, while recording four outs for an in-game ERA of 60.75. Per the Elias Sports Bureau, he became the first major leaguer to surrender at least nine runs while advancing through fewer than two innings in his debut. Said opposing starter Scott Kazmir of Mayers, "I felt for him, yeah. It's your debut, it's hot and it's on ESPN. It was a tough draw for him." The Cardinals optioned him back to Memphis the day after his first major league start. He got his first win, in relief on September 6, in Pittsburgh, pitching a perfect eighth inning. During spring training 2018, Mayers pitched 12 scoreless innings, striking out 13, earning him a spot on the Opening Day roster. He was optioned to Memphis and recalled back to St. Louis six times before being recalled for a seventh, and final time, on June 8. He was placed on the disabled list for the first time in his major league career on August 26 with right shoulder inflammation, and activated on September 11. Mayers finished his 2018 campaign with a 2–1 record and a 4.70 ERA in fifty relief appearances. Mayers began the 2019 season with St. Louis, but was placed on the injured list on April 17. He was activated on July 23. On August 4, Mayers was designated for assignment, and on August 6, he was outrighted to Memphis. On September 1, he was added to the expanded roster for September callups. Over 19 relief innings pitched with St. Louis, Mayers went 0–1 with a 6.63 ERA, striking out 16 batters.