From what I've read written by people living in Mexico, the easiest and cheapest way to get the prescription meds you need is in the mega metropolis itself MEXICO CITY!!!
It has a bad rep, but my ex boyfriend loved it. He said he just tried his best not to look like a tourist, and he was left alone.
Apparently there are sooo many pharmacies, like one on every block, and many of them are small and owned by families who are open minded.
Apparently prescriptions are not difficult to get for things like benzos. Not sure about pain meds, though.
As a foreigner, most likely you'll have to pay more, but if you're there for some time, and have the opportunity to make friends, they can tell you if you're being treated unfairly.
My ex was so impressed by how warm and friendly the people are in Mexico City. There's lots of crime and corruption, but it's such a humongous, sprawling city, how could there not be? He was there for seven weeks, and he didn't have a single negative experience.
But then again my brother was there for a single night and got robbed. He was on a tourbus full of other foreigners, and apparently that sort of thing isn't uncommon.
Maybe it's best to start out a loner until you get to know Mexicans, not other tourists.