It depends what you want the medication to do and it depends on how bad is the ulcer.
Off the shelf medication like Bonjella can soothe the pain and numb that little bit.
When my son had HFMD with several mouth ulcers, my doctor prescribed a stronger med which can numb the spot completely so that he can drink milk or eat his food.
You might want to see a doctor to get a proper assessment and medication.
My take is, if the ulcer is not affecting her sleep and diet, you can just leave it there. It should subside after a few days.