This is most likely to be an anal abscess.
Anal abscess occur due to infections of small anal glands, they are usually situated in the perianal region. They occur as a localised swelling which is very painful.
You will need to see the doctor for this. You will need to take antibiotics for this. In some cases drainage of pus is also required. Drainage is a simple office procedure.
The other possibility is an anal fissure. This is a small tear in the anal mucosa. This is a different pathology but the swelling around the tear can make it appear as a small bump. This is also very painful. It requires anti spasmodic ointments.
The third possibility is hemorrhoids. External hemorrhoids can also be felt as a bump in the region and can also be painful. Treatment for hemorrhoids is also with ointments initially.
There are other causes of bumps in the anal region: Genital warts, Condyloma accuminata, anal tag. But these are not painful and not likely for you.
You now need to see a doctor for this. Anal abscess is most likely but anal fissure and hemorrhoids are also possible.
Meanwhile you can take some steps to relieve the pain at home till you get to the doctor:
* Avoid both standing and sitting for long periods.
* The stools should be soft. This avoids pain. Have a lot of high fiber foods and water. You can also get a stool softener like Liquid Paraffin available OTC at pharmacies to keep the stool soft.
* Keep the area dry, blot gently with baby wipes.
* Apply ice. This is a great pain reliever. It will both numb the area and also help in reducing the volume.
* Bycycling exercise: lie flat on your back and cycle with your legs in the air. This helps to reduce pain.
* Sitz bath: sit in a tub containing warm saline water for about 15 min, this will help with the pain.
But do see your doctor at the earliest.