Example 1 Given that $p$ is a prime number, such that the quadratic equation in $x$, $x^{2}-2 p x+p^{2}-5 p-1=0$, has two integer roots. Find all possible values of $p$.

Translate the above text into English, please retain the original text's line breaks and format, and output the translation result directly.
Solution: Since this is a quadratic equation with integer coefficients and it has integer roots, we have
$$
\Delta=4 p^{2}-4\left(p^{2}-5 p-1\right)=4(5 p+1)
$$

is a perfect square. Therefore, $5 p+1$ is a perfect square.
Let $5 p+1=n^{2}$. Since $p \geqslant 2$, we have $n \geqslant 4$.
Notice that $5 p=(n-1)(n+1)$, and since $p$ is a prime number and $n \geqslant 4$, it is only possible that
$$
\left\{\begin{array}{l}
n-1=5, \\
n+1=p
\end{array} \text { or } \left\{\begin{array}{l}
n-1=p, \\
n+1=5 .
\end{array}\right.\right.
$$

Solving these, we get $\left\{\begin{array}{l}p=7, \\ n=6\end{array}\right.$ or $\left\{\begin{array}{l}p=3, \\ n=4 .\end{array}\right.$
When $p=3$, the original equation is $x^{2}-6 x-7=0$, solving which gives $x_{1}=-1, x_{2}=7$;

When $p=7$, the original equation is $x^{2}-14 x+13=0$, solving which gives $x_{1}=1, x_{2}=13$.

Therefore, $p=3$ and $p=7$ both satisfy the conditions. Thus, all possible values of $p$ are $p=3$ or $p=7$.

Note: Using the discriminant being a perfect square and then solving an indeterminate equation is a common method for finding integer roots of a quadratic equation.