If it means anything to you, dogs have a very high tolerance for pain, so when they scream out it is more because of them being startled or shocked than because of pain. I accidentally closed a door on my dogs tail, not hard but the startle caused him to let out a loud yelp.
He will regain trust you in over time, but an important thing to remember for the future is that dog psychology is VERY different than human psychology. Your first reaction if you accidentally hurt a child is to immediately fawn over the child and shower him/her with affection. The child needs to cognitively recognize the accident to get over it.
When you immediately get emotional, nurturing and reactive after an accident then you are teaching the dog through your nurturing that you are rewarding them for feeling scared. Nurturing is a reward for wanted behaviour so in the dogs mind you are telling the dog it is right to be scared and anxious about the very person or situation involved in the accident.
The best thing to do is to check the dog for injury, then immediately move on and try to get the dog to not dwell on what happened. After the dog is calm again, give them a treat to reward them having calmed down and give them extra affection then. It is never a good idea to give affection to a dog in emotional distress (physical distress is a bit different).
You will find the dog will move past the incident rather quickly because the dogs ancestors don't dwell on accidents. They make their intentions very known through deliberate communication and action. Dogs also live in the present. They don't dwell on past memories, their memories of what happened in the past are mostly emotional based and not event based. Eg. they smell the grounds of a dog park where they were attacked by another dog and they get an emotional surge of fear. The fear is an automatic reaction.