If you are in severe pain because of a toothache, over-the-counter pain medications like ibuprofen will help take the edge off. However, this is just a temporary solution.
You should still see a dentist as soon as possible, because usually a toothache is a sign of an underlying dental problem, and this will not go away by itself.