Painful sex

So I’ve recently tried anal sex with my boyfriend, had my period a few days later and with some other things coming up, we haven’t had sex in about 2 weeks. But since then we’ve tried twice and I’ve had to stop because it hurt/stung to have sex. Could it have anything to do with having had anal sex? If not I don’t know what’s going on...