Bangladesh beat India in thriller to win bilateral ODI series with one game to spare
Chasing 272 to win, India got off to a disappointing start losing openers Virat Kohli and Shikhar Dhawan early before half-centuries by Shreyas Iyer (82) and Axar Patel (56) got them back on track.
But India's middle order suffered a collapse and they fell just short in their run chase, ending on 266-9.
Indian captain Rohit Sharma (51 not out) came in to bat at number nine after undergoing a scan for a left thumb injury he sustained when he dropped Anamul Haque in the second over of Bangladesh's innings, and he rode his luck to take India close.
Playing through the pain - and twice dropped - he hit huge sixes off Ebadot Hossain and Mahmudullah in his 28-ball knock to leave India needing 20 off the final over and then 12 from the last two balls, but he was unable to haul his side over the line.
Earlier, Bangladesh, who also beat India by one wicket in the first ODI, were in trouble at 69-6 having elected to bat first as Washington Sundar (3-37) and Mohammed Siraj (2-73) ripped through the top order before the hosts hit back.
Mehidy combined with Mahmudullah (77) in a 148-run stand for the seventh wicket as India stepped off the gas, and he reached his century with the last ball of the innings as Bangladesh put on 271-7.
The teams meet in the final game in Chattogram on Saturday before playing two tests.