I got a horrendous toothache myself on Saturday, first time in decades. Here's what I did:
I brushed my teeth several times with a desensitizing toothpaste I'd already been using from Colgate. My teeth have been sensitive to sugary foods for some time now, I guess the enamel wearing away with age.
I stopped eating all foods & drink with sugar, as Harry mentions above. And every single time I ate something I immediately brushed my teeth again, to remove all food particles, sugars & acids.
I was going to take some ibuprofen (Motrin, Advil, et al), good for pain and inflammation. But being all out, and the pain terrible, I went for the big guns.
Some narcotic stuff I was prescribed following my cancer surgery but I never used at the time. That stuff really helped, but it took about 6 hours and 2 doses. Those are controlled substances for which you'll need to see a doctor, or maybe already were given for past pain problems.
The next day I was pain free, and remain so right now taking nothing at the moment, though the tooth is still sensitive if touched or used to chew. So I'm not touching it, and avoiding clenching my jaw, a bad habit I have. I gotta find a dentist this week, never use them, last time was at a VA hospital 7 years ago.