"You have to throw a perfect game to top Beckett," Mattingly told the South Korean left-hander.
Ryu nearly did.
"For a minute there, I thought, `Whew, he might do it,'" Mattingly said.
The Reds hit only three balls out of the infield before Frazier doubled down the left-field line on an 0-1 pitch. That followed a three-run seventh by the Dodgers in which Ryu ran the bases and scored.
Ryu came close to making the Dodgers the first team in major league history with consecutive no-hitters. Beckett won 6-0 on Sunday.
"Of course it was in the back of my mind," Ryu said through a translator, explaining that he had never carried a no-hit bid that deep. "It wasn't until the seventh that I thought it could happen."
Los Angeles pitchers tossed a club-record 17 straight hitless innings dating to Saturday, when Paul Maholm got it started against the Phillies.
The only other team since 1974 to have a no-hitter through seven innings in back-to-back games was the Oakland Athletics on July 14-15, 2005, against Texas, according to STATS.
"It gives us confidence as a ballclub that what we've been built for is to pitch," Mattingly said. "It tells me we can get on a roll."
The only other club since 1974 to pitch 17 straight hitless innings was the Los Angeles Angels from May 1-3, 2012, including Jered Weaver's no-hitter, STATS said.
"I was more nervous tonight," Mattingly said. "It's a one-run game and one swing can change the whole game. It was fun to watch until the eighth."
Cincinnati scored three times in the eighth, but right fielder Yasiel Puig made a key defensive play when he cut off Billy Hamilton's two-run double in the gap. The relay home held Skip Schumaker at third, and Kenley Jansen struck out Brandon Phillips with the bases loaded to preserve a 4-3 lead.
Jansen also worked the ninth, retiring Devin Mesoraco with two on for his 15th save.
Johnny Cueto (4-4) allowed four hits and four runs -- one earned -- in 6 1-3 innings.
Ryu (5-2) was charged with three runs and three hits in 7 1-3 innings, improving to 6-0 in six starts against the Reds. He struck out seven and walked none while winning for the first time at Dodger Stadium this season. He was 0-2 with a 9.00 ERA in three previous home starts.
"He was great through seven," said backup catcher Drew Butera, who also caught Beckett's game. "When guys see a pitcher a third time they're a little more confident. He still made some good pitches; they just found some holes."
Ryu got help from third baseman Justin Turner, who was playing for injured Juan Uribe. Turner made two diving stops in the hole against Zack Cozart his first two times up and threw him out both times.
"It was a huge part," Ryu said. "He motivated me to focus more and try a little harder."
Reds manager Bryan Price singled out Turner as a standout.
"His 16-pitch at-bat really took a lot of the starch out of Johnny in the seventh and led to their big inning," Price said.
Ryu left to a standing ovation not long after Frazier spoiled his bid for the first perfect game in the majors since Felix Hernandez accomplished the feat for Seattle against Tampa Bay on Aug. 15, 2012.
Ryan Ludwick followed with a single, moving Frazier to third. He scored on Chris Heisey's sacrifice fly that left the Reds trailing 4-1. Brayan Pena singled, bringing Mattingly to the mound to remove Ryu.
"He was throwing every pitch in any count and just kept us off balance really well," Heisey said. "He wasn't leaving anything over the middle of the plate. It was almost like he was setting up his fastball with his changeup and his curveball. He did a great job of mixing it up and not giving in."
The Reds continued the rally after Brian Wilson replaced Ryu. Wilson gave up Hamilton's two-run double and walked Cozart before he was yanked and angrily slammed his glove twice against the dugout wall. Wilson paced back and forth several times, then began clapping as Jansen was introduced.
Ryu faced a Reds lineup in which only one batter began the day batting over .264. That was Phillips, who came in hitting .281.
The Dodgers had a long inning in the seventh, which started with Turner's 16-pitch walk. Ryu was later credited with his first RBI of the season.
Cozart charged Ryu's slow bouncer to shortstop with the infield playing in, hoping for a play at the plate. Instead, Cozart bobbled the ball and all the runners were safe. Turner scored to give the Dodgers a 2-0 lead.
Los Angeles led 1-0 in the third on a two-out fielding error by Frazier, who was making his second start at first base this season because of Votto's absence.
Sandy Koufax remains the only Dodgers pitcher with a perfect game, a 1-0 win over the Chicago Cubs at home on Sept. 9, 1965. ... Hall of Fame announcer Vin Scully missed the game because of a chest cold that was expected to keep him out of the booth Tuesday as well. ... The Dodgers will give away Ryu bobbleheads on Tuesday.