I just did this on a 2008 Mazda5 I purchased back in June. The car had 75,000 miles on it and I assumed I wouldn't have to worry about bearings for a while. Was surprised when my first highway ride revealed a roaring sound (test drive was all local roads in downtown Washington DC). It seemed to be coming from the front so I assumed it was a bad front bearing. After paying a shop to replace both front bearings (after they confirmed that is what the problem was), the noise was the same (so much for relying on the troubleshooting skills of a professional mechanic). No obvious indications that the rear bearings were bad, but the noise went away in a right turn, so I was pretty sure it was a bad right bearing.
I bought a pair of Timkens from Rock Auto and took care of the right side and the noise is now gone. I expected some difficulty with stuck fasteners, but had no major issues with them. I did get stuck for 3 hours with a hub that would not come off. I eventually lowered car down so the brake disk rested on some wood blocks (the disks were being replaced anyway), and I was able to start loosening the hub. I did do some online research and found some descriptions of the job, but no one mentioned this problem (search under Mazda3, which has the same chassis, and you may have more luck finding articles). The new hub slipped right in with no issues, so I guess there was just enough corrosion on the old hub to fuse it to the suspension arm. I have not tackled the left side yet, but I expect this to go easier as I now have some experience. Waiting for cooler weather to do it, as it makes no noise right now.
A couple of tips. While it will be easier to remove the hub bolts with the rear shock taken off, it is not required. There is a special torx socket required for the hub bolts, I can't remember the size, but I want to say either T45 or T50. The ABS sensor requires a special female torx socket as well, but found I could remove it with a regular socket, as it had no real torque holding it in. Replacing the rear brake disks at the same time may be a good idea, as the cost is minimal, it removes a step of the disassembly, and they may be nearing their replacement point anyway. I would use either OEM hub or a Timken. The Timken is about $40 less OEM, but I found that the ABS retainer nut needs modification to work with the original factory bolt (there is supposed to be a hole for the bolt to go all the way through the plastic plate, but Timken does not fabricate it this way, so I had to drill a hole in the plastic behind the nut, being careful not to damage the ABS ring). The other option is to just purchase a new standard bolt that isn't as long. I would have done this if I knew in advance it was needed.
I don't know why mine was bad. The chassis has low-ish miles, there wasn't really any major rusting on the chassis to indicate severe conditions, and there was no indication that the rear wheel hit a curb or pothole.
While I like the packaging and concept of the Mazda5, I am a bit disappointed with some of the engineering details of Mazda's. Just wait until your driver door power lock fails (and it will). Another thing I knew was bad when I bought the car, but assumed it would be a simple fix (based on past experiences with a BMW power lock). Not the case, as I needed to purchase an entire new door lock assembly, since the design of the part allows no repair.
Jim