Temple, 32, gives the Grizzlies one more versatile, veteran wing as they reshape the roster to try to return to the Western Conference playoffs this season.
Temple averaged 8.4 points in 25 minutes per game for the Kings last season. Along with the signing of Spurs free agent Kyle Anderson, the Grizzlies are fortifying wing spots to support the return of point guard Mike Conley and center Marc Gasol.
The Grizzlies will be Temple's seventh NBA team in nine seasons.
The deal clears an additional $1 million in salary-cap space for the Kings, who now have $20.5 million.
McLemore returns to the Kings, who drafted him seventh overall in 2013. He played for Sacramento until signing a free-agent deal with Memphis in 2017.
Davis, 21, was the No. 31 overall pick in the 2016 NBA draft and struggled to gain traction in the Grizzlies' rotation.