Yes, you can have pain meds. You SHOULD have pain meds. If you are in pain, you could have trouble making milk. (Not everyone does, but it's according to your pain tolerance.)
Also, taking pain medication helps you heal. The body is in a lot of stress being in pain. You don't need to keep a "stiff upper lip" and just plod through. You need to take care of yourself.
The OB/GYN will give you a prescription for pain medicine that is safe for you and for baby.
Another thing to remember is that your doctor gives you instructions for coming home that are important. No lifting anything heavier than your baby. Sleep when the baby sleeps. REST. Women who try to clean house, cook and do too much end up bleeding a lot and hurting their health. You also could end up with a uterine infection and end up back in the hospital. You need to heal inside and that means just taking care of yourself and the baby. If someone comes over to see you, DON'T play hostess. You stay on that couch or in the bed with baby and nothing else. Don't fix them lunch or offer them a drink. Honestly, the people who come expecting to be catered to just astound me...
Don't take baths until the doctor tells you it's safe too - showers only. Drink plenty of water and whatever else the doctor tells you.
It's not a race to heal. It's a process. Good luck!