Question: Prove that if for some $a,b\in\mathbb{Z}$, an odd prime number $p\mid (a^2+2b^2)$, but $p \nmid a$ and $p\nmid b$, then there is a solution $x$ for the congruence $x^2\equiv -2 \pmod{p}$.
This is (a variant of) the problem $59$ of Section $2.1$ of An Introduction to The Theory of Numbers by Ivan Niven et al.
My Attempt: I tried to use Wilson's theorem and Fermat's little theorem to construct a square number which is congruent to $-2$ modulo $p$. But I failed. How may I use the fact that $p\mid (a^2+2b^2)$? Could anyone give me a hint, please?
$p\mid (a^2+2b^2)$ is another way of writing $a^2+2b^2 \equiv 0 \pmod p$, or $$a^2 \equiv - 2b^2 \pmod p$$ Since $p$ is prime and doesn't divide $b$, $b$ has a multiplicative inverse $\bmod p$.