In his filing, Mayer admitted the situation has caused him to "suffer substantial emotional distress".
A judge ordered Knight - who has a substantial criminal record - to stay at least 100 feet away from the singer and his home.
A court hearing has been scheduled for 27 August to determine whether the order should be made permanent.
Meanwhile, Tiffany Haddish recently revealed she has turned to the New Light singer for dating advice.
She said: "I've been talking with a lot of people, you know.
"I've been getting relationship advice since the last time I was here. John Mayer has been giving me relationship advice.
And asked what the specific advice was from John, she shared: "He said if there's somebody that I like that's in the eye of the public, I should ... when I'm doing interviews, say that I'm seeing that person.
"And then the media will do a side-by-side of us and then the guy will see and then he'll be like, 'Oh, she's kinda cute. I mean, I'm not hooking up with her but I could hook up with her.'"