Thanks for asking the query,
Pain while opening the mouth can be due to Temporomandibular joint disorders.
I would suggest you to visit to an Oral and Maxillofacial Surgeon and get the checkup done,
Take an OPG radiograph to look for the condition of the joint.
Also look for any errupting or impacted wisdom tooth
even this may cause similiar symptoms.
Take muscle relaxants like meftal
Apply moist heat towels externally over both the sides of TMJ
as many times as possible.
Avoid eating of hard food, take a semisolid diet.
Hope this helps out.