Firstly diagnose it and find the reason behind it. And till this you should use analgesic .
The medicine used to treat the pain is commonly known as analgesic. Like dynopar ,aldigesic, Ibogesic
Take analgesics for temporary relief of pain only. Pain will resolve only if the affected tooth is dealth with either endodontically (RCT) or extraction.